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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Good Morning,
Thanks in advance for your assistance!
I have a grouping in PowerQuery but would like to also multiple the result of the grouping by -1. Traditionally I would add a custom column after grouping to do so and then remove the original. Is there a way to do this during the same step as the grouping? Would likely speed up performance...
Here is my grouping code, where you'll notice I've named some of the resulting aggregates with the negative sign:
= Table.Group(#"dbo_DATABASE$Value Entry", {"Item Ledger Entry No_"}, {{"Sales Amount", each List.Sum([#"Sales Amount (Actual)"]), type number}, {"-Cost Amount (Actual)", each List.Sum([#"Cost Amount (Actual)"]), type number}, {"-Cost Amount (Expected)", each List.Sum([#"Cost Amount (Expected)"]), type number}})
Thanks
Michael
Solved! Go to Solution.
You can manually edit that step in the formula by and put -1 * in it as follows:
= Table.Group(#"dbo_DATABASE$Value Entry", {"Item Ledger Entry No_"}, {{"Sales Amount", each List.Sum([#"Sales Amount (Actual)"]), type number}, {"-Cost Amount (Actual)", each -1 * List.Sum([#"Cost Amount (Actual)"]), type number}, {"-Cost Amount (Expected)", each -1 * List.Sum([#"Cost Amount (Expected)"]), type number}})
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
You can manually edit that step in the formula by and put -1 * in it as follows:
= Table.Group(#"dbo_DATABASE$Value Entry", {"Item Ledger Entry No_"}, {{"Sales Amount", each List.Sum([#"Sales Amount (Actual)"]), type number}, {"-Cost Amount (Actual)", each -1 * List.Sum([#"Cost Amount (Actual)"]), type number}, {"-Cost Amount (Expected)", each -1 * List.Sum([#"Cost Amount (Expected)"]), type number}})
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thanks Pat!
It did indeed work but the impact to performance was negative. I opted to reverse the sign later in DAX using a measure instead.
Thanks for the tip and KUDOS!!
Michael
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 37 | |
| 33 | |
| 29 | |
| 26 |
| User | Count |
|---|---|
| 134 | |
| 104 | |
| 63 | |
| 60 | |
| 55 |