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

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.

Reply
DJB
Frequent Visitor

Add a column with just the sum of negative values from other columns

Hi everyone,

 

I got quite an extensive data model in which I would like to make some calculations on row level. One of them is to separate negative (and eventually positive) values from different columns by summarzing them in two new columns.

 

In this example I would like the sum of the negative values in columns "delta +1", "delta +2", "delta +3" and " Delta +4". The third row should show -10.000.000

 

How can this be solved in an easy way?

 

Thanks in advance!

 

Capture.PNG

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

@DJB

In the Power Query editor, you could add a Custom Column with expression in the dialog box:

List.Sum ( List.Select( { [#"delta + 1"], [#"delta + 2"], [#"delta + 3"], [#"delta + 4"] }, each _ < 0 ) )

In a DAX calculated column, you could use this formula:

Negative Sum =
VAR Numbers = { TableName[delta + 1], TableName[delta + 2], TableName[delta + 3], TableName[delta + 4] }
VAR NegativeNumbers = FILTER ( Numbers, [Value] < 0 )
RETURN SUMX ( NegativeNumbers, [Value] )

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

4 REPLIES 4
zlokesh
Resolver I
Resolver I

Please check with the simple logic like    Sum(if values less than zero)

OwenAuger
Super User
Super User

@DJB

In the Power Query editor, you could add a Custom Column with expression in the dialog box:

List.Sum ( List.Select( { [#"delta + 1"], [#"delta + 2"], [#"delta + 3"], [#"delta + 4"] }, each _ < 0 ) )

In a DAX calculated column, you could use this formula:

Negative Sum =
VAR Numbers = { TableName[delta + 1], TableName[delta + 2], TableName[delta + 3], TableName[delta + 4] }
VAR NegativeNumbers = FILTER ( Numbers, [Value] < 0 )
RETURN SUMX ( NegativeNumbers, [Value] )

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Thank you !

 

This was on page 4 on google when googling "power query add multiple columns only if positive number" - so ill just add that phrase to it. also

"power query add multiple columns only if conditions are meet. "

perhaps this will help others find it in the future

DJB
Frequent Visitor

Thanks for the prompt reply Owen! I used the DAX calculated columns and this is what I was looking for.

 

Dennis

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.