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
Rigolleto
Resolver I
Resolver I

Use Power Query to show the high value of a list of a columns grouped

Hi,

Could someone help me with some advise with this, as you can see in the screenshot, left side, I have 3 columns, STYLE, COLOR and TOTAL UNITS SOLD, basically what I need is the way to get an output like the fig 2 show, notice that for Style A  has 3 colors, I need to get from A only the high values, the same for STYLE B.

I did try grouping but when I use a MAX for COLOR Column then instand of show =  A C1 200 then I am getting A C3 200, see that the COLOR is geeting the highest , because the max()

 

Fig 1                                                            Fig 2

Breaby style.png

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @Rigolleto ,

 

How about this?

 

Before:

tackytechtom_1-1707479782824.png

 

 

After:

tackytechtom_0-1707479701016.png

 

 

Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZY67DYAwDER3cZ3CHyJqzBiR91+DJChgjuak96TzuTU6qNApPZSZoiQhKGpi7bGh+DR03nzZcMOwcYvJ/nxVQayGw1e+NncGISg08dg0BiF/QREX", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Style = _t, Color = _t, #"Total Units Sold" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Style", type text}, {"Color", type text}, {"Total Units Sold", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Style", "Color"}, {{"Total Units Sold", each List.Max([Total Units Sold]), type nullable number}})
in
    #"Grouped Rows"

 

Let me know, if this solves your query 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

1 REPLY 1
tackytechtom
Super User
Super User

Hi @Rigolleto ,

 

How about this?

 

Before:

tackytechtom_1-1707479782824.png

 

 

After:

tackytechtom_0-1707479701016.png

 

 

Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZY67DYAwDER3cZ3CHyJqzBiR91+DJChgjuak96TzuTU6qNApPZSZoiQhKGpi7bGh+DR03nzZcMOwcYvJ/nxVQayGw1e+NncGISg08dg0BiF/QREX", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Style = _t, Color = _t, #"Total Units Sold" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Style", type text}, {"Color", type text}, {"Total Units Sold", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Style", "Color"}, {{"Total Units Sold", each List.Max([Total Units Sold]), type nullable number}})
in
    #"Grouped Rows"

 

Let me know, if this solves your query 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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