Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

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. 

 

5 Replies

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 
    What is the purpose of the IF statement?

    • Anonymous's avatar
      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

      • tamerj1's avatar
        tamerj1
        Icon for Community Champion rankCommunity Champion

        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