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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
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!

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