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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Measure based on data from another measure with condition

Hi

Could you please help me to find a solution?  The task is to calculate the deviations from the previous year by positions, provided that there is a zero value in the previous period. That is, the task is to counting in case if in last period this position value is zero. Data for the past period are calculated using the measure:

Previous Year = CALCULATE(SUM('Table1'[summa]),SAMEPERIODLASTYEAR('Calendar'[Date]))
Next I'm trying to use this formula:
vs Previous Year = IF(CALCULATE('Table1'[Previous Year])=0,(SUM('Table1'[summa])-'Table1'[Previous Year]),0)
And I see deviation by position, but I don't see totals and subtotals value. 
KSU_10_0-1658233656109.png

 

5 REPLIES 5
tamerj1
Super User
Super User

Hi @Anonymous 
What is the purpose of the IF statement?

Anonymous
Not applicable

Hi 

if  value of position in previous year = 0  in this case need calculate difference between previous year and actual year. Indeed this is short version of formula, for checking work it or not

@Anonymous 
But if the previous year is zero then the difference is just the current year! Also would you please clarify what are you slicing by in your report. Thank you

Anonymous
Not applicable

Indeed I need calculate mix factor, 

I've got a lot of items, some of them were produced in this year, but weren't in previous? and some of them weren' produce this year, but were in previous period. And I need to calculate (Value per position this year - Value per position previos year) in case if or Value per position this year =0 or Value per position previous year =0. This is full task 

 

Hi, @Anonymous 

Can you share a sample file for further research?

Best Regards,
Community Support Team _ Eason

Helpful resources

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

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.