• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

How to get minimum value with condition like MINIFS formula in Power Query?|Power Query|Excel Forum|My Online Training Hub

You are here: Home / How to get minimum value with condition like MINIFS formula in Power Query?|Power Query|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower QueryHow to get minimum value with condi…
sp_PrintTopic sp_TopicIcon
How to get minimum value with condition like MINIFS formula in Power Query?
Avatar
karthikumar sakthivel

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
May 31, 2021
sp_UserOfflineSmall Offline
1
May 31, 2021 - 9:21 pm
sp_Permalink sp_Print

Hi All, 

I am new to power query. I would like to get the minimum value with condition using power query. However, I am not able to find the solution. 

 

For example, Cheapest price for the given product needs to be found for that specific current month. For the first moth (Jan), we cant find the minimum value. The condition is Product specific and we need to compare the price of the product in previous months only  not with current month. 

 

Herewith I have given the table that contains the cheapest price which I want to do using power query. Is it possible?

Product Month Price Cheapest price (Minimum value with conditino like MINIFS)
A Jan 50 50
A Feb 45 50
A Mar 30 45
A Apr 40 30
A May 100 30
B Jan 15 15
B Feb 20 15
B Mar 25 15
C Jan 100 100
C Feb 89 100
C Mar 85 89

 

Request you to provide your inputs.

 

Please let me know if you need more details in this regard. 

Thank you, 

Regards, 

Kumar

sp_AnswersTopicSeeAnswer See Answer
Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
2
June 2, 2021 - 4:59 pm
sp_Permalink sp_Print

Hi Kumar,

Can you provide some sample data? The data you have provided looks like the desired output, not initial data.

You should be able to do that by Grouping, (Transform>Group By year and month), with the Min function.

Add 2 index columns, one starting from 0 and 1 starting from 1, merge the table with itself, this will create the offset that brings the previous month minimum.

sp_AnswersTopicAnswer
Answers Post
Avatar
karthikumar sakthivel

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
May 31, 2021
sp_UserOfflineSmall Offline
3
June 3, 2021 - 5:14 pm
sp_Permalink sp_Print

Hi Catalin Bombea,

Thank you so much for providing your solution. 

As you suggested, I have attached the sample data and output data which I want. 

Kindly find the attachment. 

If possible, Could you please generate the required output using PowerQuery?

Thank you, 

 

Regards, 

Kumar

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
4
June 4, 2021 - 5:03 am
sp_Permalink sp_Print

Here is an example.

Avatar
karthikumar sakthivel

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
May 31, 2021
sp_UserOfflineSmall Offline
5
June 4, 2021 - 4:53 pm
sp_Permalink sp_Print

Hi Catalin Bombea,

Thank you for generating the output. 

Please note that the condition is getting the minimum value from all previous months and product specific. 

Generated output is giving or verifying the previous month only not all previous months. 

If you refer my initial table, as of May month for A product, cheapest price is 30 which belongs to March month. 

Could you please generate the output with all previous months (the range needs to be selected from the initial price to previous month's price for getting the minimum value)?

Thank you, 

 

Regards, 

Kumar

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
6
June 5, 2021 - 12:51 pm
sp_Permalink sp_Print

Try this one.

Avatar
karthikumar sakthivel

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
May 31, 2021
sp_UserOfflineSmall Offline
7
June 6, 2021 - 4:11 am
sp_Permalink sp_Print

That's awesome. It works really cool. Thank you Catalin Bombea for your wonderful support. 

I am able to get the output using your suggested method. Thanks a lot!!!

Regards, 
Kumar

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
8
June 6, 2021 - 12:15 pm
sp_Permalink sp_Print

you're welcome

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online:
Guest(s) 8
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 205
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
stuart burge
Bruce Tang Nian
Scot C
Othman AL MUTAIRI
Misael Gutierrez Sr.
Attif Ihsan
Kieran Fee
Murat Hasanoglu
Brett Dryland
Saeed Aldousari
Forum Stats:
Groups: 3
Forums: 24
Topics: 6223
Posts: 27295

 

Member Stats:
Guest Posters: 49
Members: 31920
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.