Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Power Query Grouping *-1

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

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

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





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

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





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.