Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
olimilo
Continued Contributor
Continued Contributor

[Power Query] Get max/min of group of rows without grouping?

I'm aware of getting the min/max of a column based on an identifier by grouping the rows according to the identifier column, but is there a way to do this without needing to group the rows according to the identifier column in Power Query?

 

For example, in the table below, to get the min/max ModifiedDate value, I have to group them according to the ID column and do an aggregate. For a small dataset, this is acceptable but when I reach 100k+, it seems to tank performance.

 

ID ModifiedDate
1001453455 12/30/2022 1:17:24 AM
1001453455 12/29/2022 9:55:49 PM
1001495147 8/8/2022 12:20:10 PM
1001495147 7/28/2022 5:19:42 PM
1001507515 7/26/2022 1:36:43 PM
1001507515 8/10/2022 12:08:26 PM
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @olimilo 

You can create a custom column and input the following code

=List.Max(Table.SelectRows(the last step name(e.g #"Changed Type"),(x)=>x[ID]=[ID])[ModifiedDate])

vxinruzhumsft_0-1700184195316.png

Output

vxinruzhumsft_1-1700184210414.png

and you can refer to the attachment below.

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

If you are interested, this can be solved with a calculated column formula in DAX as well.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @olimilo 

You can create a custom column and input the following code

=List.Max(Table.SelectRows(the last step name(e.g #"Changed Type"),(x)=>x[ID]=[ID])[ModifiedDate])

vxinruzhumsft_0-1700184195316.png

Output

vxinruzhumsft_1-1700184210414.png

and you can refer to the attachment below.

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

the solution works, but the performance of my power query is horrible after I appplied the solution. I mean I could not load the table to excel sheet because the excel stop responding before it can finish. Do you have any suggestion to solve this issue?

Ps.

1. data source is from sharepoint

2. the table has about 4,xxx rows and about 30 columns (after removed the uncessary columns).

3. it also takes a very long time to open the power query after I applied the solution.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.