Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
I am trying to group data set to reflect the Max of the Total column.
I have this data set
Date | ProductID | Price | Orders | Total |
1-Jan | a12 | 11 | 1 | 11 |
1-Jan | a13 | 12 | 3 | 36 |
1-Jan | a13 | 12 | 2 | 24 |
2-Jan | a12 | 11 | 4 | 44 |
2-Jan | a12 | 11 | 2 | 22 |
2-Jan | a12 | 11 | 5 | 55 |
I want to get it grouped by Date and ProductID and reflect Max on this date for ProductID
Date | ProductID | Price | Orders | Total | Max |
1-Jan | a12 | 11 | 1 | 11 | 11 |
1-Jan | a13 | 12 | 3 | 36 | 36 |
2-Jan | a12 | 11 | 5 | 55 | 55 |
Solved! Go to Solution.
Hi @Beck ,
You can use the group by feature:
Here's a sample code
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtT1SsxT0lFKNDQCkoaGIALCiNVBljUGCYKUgBjGZrhkwdgELGuEabIJCOOUBes1wiVrCsKmSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, ProductID = _t, Price = _t, Orders = _t, Total = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"ProductID", type text}, {"Price", Int64.Type}, {"Orders", Int64.Type}, {"Total", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Date", "ProductID", "Price"}, {{"Orders", each List.Max([Orders]), type nullable number}, {"Total", each List.Max([Total]), type nullable number}})
in
#"Grouped Rows"
Hi @Beck ,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information and description to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Hi @Beck ,
You can use the group by feature:
Here's a sample code
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtT1SsxT0lFKNDQCkoaGIALCiNVBljUGCYKUgBjGZrhkwdgELGuEabIJCOOUBes1wiVrCsKmSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, ProductID = _t, Price = _t, Orders = _t, Total = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"ProductID", type text}, {"Price", Int64.Type}, {"Orders", Int64.Type}, {"Total", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Date", "ProductID", "Price"}, {{"Orders", each List.Max([Orders]), type nullable number}, {"Total", each List.Max([Total]), type nullable number}})
in
#"Grouped Rows"
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |