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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
dogburalHK82
Helper III
Helper III

group by with condition

Hi, 

 

in power query, when groping rows is there any way using Power M to pick column from each column as below

 

For Quanity ordered column, select maxium value

For remaining, columns are selected from the row where Receipt date is bigger 

 

dogburalHK82_2-1684476338774.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @dogburalHK82 ,

 

Here's my sample data. I also added a third row for a better demo. A column of Group IDs has also been added, and I think you have a similar column in your data for grouping.

vstephenmsft_4-1684722183045.png

Here's my solution.

1.You can group like this.

vstephenmsft_0-1684721103058.png

vstephenmsft_1-1684722126185.png

 

2.Expand rows.

vstephenmsft_2-1684722155447.pngvstephenmsft_3-1684722173064.png

3.Add a conditional column.

vstephenmsft_5-1684722375156.png

 

4.Filter out "0".

vstephenmsft_7-1684722412496.png
vstephenmsft_6-1684722404508.png

 

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
dogburalHK82
Helper III
Helper III

@Anonymous thank you for the detailed instruction. 

Anonymous
Not applicable

Hi @dogburalHK82 ,

 

Here's my sample data. I also added a third row for a better demo. A column of Group IDs has also been added, and I think you have a similar column in your data for grouping.

vstephenmsft_4-1684722183045.png

Here's my solution.

1.You can group like this.

vstephenmsft_0-1684721103058.png

vstephenmsft_1-1684722126185.png

 

2.Expand rows.

vstephenmsft_2-1684722155447.pngvstephenmsft_3-1684722173064.png

3.Add a conditional column.

vstephenmsft_5-1684722375156.png

 

4.Filter out "0".

vstephenmsft_7-1684722412496.png
vstephenmsft_6-1684722404508.png

 

Best Regards,

Stephen Tao

 

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.