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
BigTommy
Helper I
Helper I

subtraction from zero....

Hi Guys, 

 

Hope you kepping well. I have an issue and cannot fix this. I beleive this is soemthing really simple but....

 

DateItem numberAvg Unit cost 2019Current unit costVariance
14/02/2020122.3702.37
12/02/2020122.372.300.07
10/03/202011.31.10.2

 

The Variance is calculated Avg Unit Cost 2019 - Current Unit Cost

So:

2.37 - 2.3 = 0.07

1.3 - 1.1 = 0.2

and

2.37 - 0 = 2.37 which is ok however, I am looking somethign different. 

 

So I want to compare the current average purchase price with the previous. But when I subtracting from zero it will always give me previos value not 0. 

 

I want

If the Current Unit Cost = 0
return Zero in Variance Unit cost

OTHERWISE

Current Product Unit Cost - Avg Product Unit cost

 

 

SEND HELP!!

 

Thnak you

 

BigTommy

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@BigTommy 

please try

if ( currentunitcost=0, 0, currentunitcost-avgunitcost )





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
BigTommy
Helper I
Helper I

Hey, thank you. Is working!

 

 

amitchandak
Super User
Super User

@BigTommy , Try like

new column =
if ( Table[currentunitcost]=0, 0, Table[currentunitcost]-Table[avgunitcost] )

new measure =
if ( Avg(Table[currentunitcost])=0, 0, Avg([currentunitcost])-Avg([avgunitcost]) )
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
ryan_mayu
Super User
Super User

@BigTommy 

please try

if ( currentunitcost=0, 0, currentunitcost-avgunitcost )





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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