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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.