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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Power Query : Min of group of values

Hello everyone,

 

I have this kind of table :

Code - Value

N1 - 1

N1 - 4
N1 - 7

N2 - 3

N2 - 5

N2 - 5

N3 - 7

N3 - 9

 

I want to filter data to have the minimum VALUE for each CODE like this :

N1 - 1

N2 - 3

N3 - 7

 

How to do it in a query in Power Query ?


Thank you.

2 ACCEPTED SOLUTIONS
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can use Group By as per below.

 

image.png

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

MFelix
Super User
Super User

Hi @Anonymous ,

 

You need to go to the Transform  part then Group by, select the Code as the Group by column and in the operation select Minimum of the column value:

 

Group_by.png


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

8 REPLIES 8
MFelix
Super User
Super User

Hi @Anonymous ,

 

You need to go to the Transform  part then Group by, select the Code as the Group by column and in the operation select Minimum of the column value:

 

Group_by.png


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Thank you for your answers @Mariusz and @MFelix 

 

The problem is that when I do this "Group by", my others columns disappears.

 

BEFORE

01.PNG

 

AFTER

02.PNG

Hi @Anonymous ,

 

Do you want to keep all the other column and on the Value repeat the minimum value?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix, yes, how can this be done? I want to keep same number of records and repeat the minimum value for each group 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Yes absolutely. In the sample example given above, i would like to see the following output.

Input:

N1 - 1

N1 - 4
N1 - 7

N2 - 3

N2 - 5

N2 - 5

N3 - 7

N3 - 9

 

Output:

 

N1 - 1 - 1

N1 - 4 - 1
N1 - 7 - 1

N2 - 3 - 3

N2 - 5 - 3

N2 - 5 - 3

N3 - 7 - 7

N3 - 9 - 7

Hi @Anonymous 

 

Please see the attached file with a solution.

This will involve some M scripting, so let me know if you need help.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can use Group By as per below.

 

image.png

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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