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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
BeckersN
New Member

Total in calculated column returns as 0 due to IF statement

Hi

 

I have a table with a calculated column to show current stock minus next 3 months forecast, with the goal of flagging which products have too much cover.

Some of these return a negative value, which is good as it means we don't have too much stock. To negate these results, I added an IF statement to return that result as 0 instead.

 

The issue I have now is that the total of that column was a negative amount and it now shows as 0 too, where I want it to show the sum of the positive values.

BeckersN_1-1714033416063.png

 

BeckersN_0-1714033277646.png

 

can I somehow exclude the Totals value from this?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@BeckersN , You need to use sumx

 

return

Sumx(Values(Table[Column]), if(Result <0, 0, Result )

 

for more than one column

 

return

Sumx(Summarize(Table, Table[Column]), if(Result <0, 0, Result )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@BeckersN , You need to use sumx

 

return

Sumx(Values(Table[Column]), if(Result <0, 0, Result )

 

for more than one column

 

return

Sumx(Summarize(Table, Table[Column]), if(Result <0, 0, Result )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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