Forum

MIN/MAX Function eq...
 
Notifications
Clear all

MIN/MAX Function equivalent in pq?

7 Posts
5 Users
0 Reactions
2,114 Views
(@matthias)
Posts: 49
Trusted Member
Topic starter
 

Hello, is there a kind of Max or Min function in powerquery to compare the values of different columns? I want to add a custom column which gives for each line the max value of other (existing) columns.

=> something like Max([ColumnX],[ColumnY],[ColumnZ])

 
Posted : 22/01/2018 4:06 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Matthias,

Select the 3 columns you want to derive the max and min from > Add Column tab > Statistics > Max. Repeat for Min column.

Note: this will compare the 3 values per row and return the max/min for that row, not the max/min for the whole column.

Mynda

 
Posted : 22/01/2018 11:56 pm
(@matthias)
Posts: 49
Trusted Member
Topic starter
 

Thanks, Mynda! That helped a lot, with this info I could use List.Max exactly how I needed it.

Thanks again,
Matthias

 
Posted : 23/01/2018 5:08 pm
(@mynda)
Posts: 4761
Member Admin
 

Great! Glad it was what you were after.

 
Posted : 23/01/2018 10:15 pm
(@baladi)
Posts: 1
New Member
 

Hello, is there a kind of Max or Min function in powerquery to compare the values of One columns? I want to add a custom column which gives for each line the max value of other (existing) columns.

=> something like Max([ColumnX])

 
Posted : 11/02/2019 5:32 am
(@jjoyce)
Posts: 1
New Member
 

Hi there,

Is there a way to do the same with Dates?  When I tried the above with Dates, the Min/Max is greyed out (unavailable).

I want to find the Min and Max per position number in Power Query for the following example:

Position #   Begin Date   End Date           Min Date     Max Date

12345         1/10/10       1/10/13             1/10/10       31/12/99

12345         2/10/13       2/10/15             1/10/10       31/12/99

12345         3/10/15       31/12/99           1/10/10       31/12/99

67890         1/3/16         1/4/18               1/3/16        31/12/99

67890         2/4/18         1/4/19               1/3/16        31/12/99

67890         2/4/19         31/12/99            1/3/16        31/12/99

 

Look forward to hearing from you.

🙂

 
Posted : 18/03/2020 3:14 pm
(@bluesky63)
Posts: 162
Estimable Member
 

Hi Jane Joyce

Not sure this is what you want

Unpivot > Group by > aggregate so that you can find min of a list of dates (Col 1..... Col x)

You maximum always "31/12/9999" ? 

 
Posted : 21/03/2020 2:15 am
Share: