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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.