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

View all the Fabric Data Days sessions on demand. View schedule

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

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors