Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi, the power query 'group by' function seems very similar to pivot tables in Excel, apart from one major flaw (for me). There is no option to get the PRODUCT of the values, as opposed to the sum, average, min etc. Does anyone have a workaround where by I could get the PRODUCT of a column, and group the results by values in other columns?
Solved! Go to Solution.
You can use whatever function you'd like with a small tweak to the code. Do the Group By using Sum and it will generate a step that looks like this:
Edit the code in the formula bar to replace List.Sum with List.Product and it will take the product over the group instead of the sum.
Sample M code you can paste into your Advanced Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXIEYiOlWJ1oIAnhGYN5xkCWExCbgHkmUDlDMM8UKgfRZwaVA6qMBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Group = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Group", type text}, {"Value", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Group"}, {{"Value", each List.Product([Value]), type nullable number}})
in
#"Grouped Rows"
I use this trick with other operators too. For example, Text.Combine to concatenate text rows.
Wow - that is so simple and the perfect solution for me. Thanks!
You can use whatever function you'd like with a small tweak to the code. Do the Group By using Sum and it will generate a step that looks like this:
Edit the code in the formula bar to replace List.Sum with List.Product and it will take the product over the group instead of the sum.
Sample M code you can paste into your Advanced Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXIEYiOlWJ1oIAnhGYN5xkCWExCbgHkmUDlDMM8UKgfRZwaVA6qMBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Group = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Group", type text}, {"Value", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Group"}, {{"Value", each List.Product([Value]), type nullable number}})
in
#"Grouped Rows"
I use this trick with other operators too. For example, Text.Combine to concatenate text rows.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 5 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 20 | |
| 14 | |
| 11 | |
| 10 | |
| 9 |