Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi there,
I have dataset with following columns:
Account
Date
Amount
I want to group by data in power query
Group by Date, Account, Sum of Amount
Group by Date, Sum of Amount
Need this in Power Query
Thanks,
P
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Solved! Go to Solution.
Ah, now I understand.
First group by at the lowest level, next group by the higher level, adding aggregation "all rows":
This is the generated code, in which Value.Type(#"Grouped Rows") in step #"Grouped Rows1" is a manual replacement of the generated type table. I consider it a bug (or a mistake by Microsoft) that the nested tables with "All Rows" get type table instead of the type of the original table. As explained in this video (it's a longer video, the link jumps to the relevant fragment).
let Source = Table1, #"Grouped Rows" = Table.Group(Source, {"account", "date"}, {{"sum of amount", each List.Sum([amount]), type number}}), #"Grouped Rows1" = Table.Group(#"Grouped Rows", {"date"}, {{"total amount", each List.Sum([sum of amount]), type number}, {"AllRows", each _, Value.Type(#"Grouped Rows")}}), #"Expanded AllRows" = Table.ExpandTableColumn(#"Grouped Rows1", "AllRows", {"account", "sum of amount"}, {"account", "sum of amount"}), #"Sorted Rows" = Table.Sort(#"Expanded AllRows",{{"account", Order.Ascending}, {"date", Order.Ascending}}), #"Reordered Columns" = Table.ReorderColumns(#"Sorted Rows",{"account", "date", "sum of amount", "total amount"}) in #"Reordered Columns"
Looks to me like 2 straightforward group by's, so what's the issue?
This is the one for Date and Account:
@MarcelBeugi want the another one with date only, this one is date + account
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Just leave out Account then:
Going off line now.
i need both that is what I'm looing for:
i need group by date + account and also by date only
sorry if i was not clear.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
so the expect result for following sample data:
account date amount
1 Jan 01 100
1 Jan 02 200
1 Jan 02 300
2 Jan 01 300
2 Jan 02 400
2 jan 03 500
2 jan 03 500
account date sum of amount total amount
1 jan 01 100 400
1 jan 02 500 900
2 jan 01 300 400
2 jan 02 400 900
2 jan 03 1000 1000
sum of amount = group by account + date
total amount = group by date
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Ah, now I understand.
First group by at the lowest level, next group by the higher level, adding aggregation "all rows":
This is the generated code, in which Value.Type(#"Grouped Rows") in step #"Grouped Rows1" is a manual replacement of the generated type table. I consider it a bug (or a mistake by Microsoft) that the nested tables with "All Rows" get type table instead of the type of the original table. As explained in this video (it's a longer video, the link jumps to the relevant fragment).
let Source = Table1, #"Grouped Rows" = Table.Group(Source, {"account", "date"}, {{"sum of amount", each List.Sum([amount]), type number}}), #"Grouped Rows1" = Table.Group(#"Grouped Rows", {"date"}, {{"total amount", each List.Sum([sum of amount]), type number}, {"AllRows", each _, Value.Type(#"Grouped Rows")}}), #"Expanded AllRows" = Table.ExpandTableColumn(#"Grouped Rows1", "AllRows", {"account", "sum of amount"}, {"account", "sum of amount"}), #"Sorted Rows" = Table.Sort(#"Expanded AllRows",{{"account", Order.Ascending}, {"date", Order.Ascending}}), #"Reordered Columns" = Table.ReorderColumns(#"Sorted Rows",{"account", "date", "sum of amount", "total amount"}) in #"Reordered Columns"
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 |
---|---|
84 | |
76 | |
73 | |
42 | |
36 |
User | Count |
---|---|
109 | |
56 | |
52 | |
48 | |
43 |