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
KSU_10
Frequent Visitor

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 @KSU_10 
What is the purpose of the IF statement?

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

@KSU_10 
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

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, @KSU_10 

Can you share a sample file for further research?

Best Regards,
Community Support Team _ Eason

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.