Forum Discussion

rkxiii's avatar
rkxiii
Frequent Visitor
2 years ago
Solved

How to get the Percent Difference from previous data

I would like to know what formula to use to get the percentage difference from the previous data that I have (seen from the image). Thank you!
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, rkxiii 

     

    You can try the following methods.

    Measure:

    Diff = 
    Var _Prevdate=CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),[Date]<SELECTEDVALUE('Table'[Date])))
    Var _PrevYield=CALCULATE([Yield],FILTER(ALL('Table'),[Date]=_Prevdate))
    RETURN
    IF(_PrevYield=BLANK(),BLANK(),[Yield]-_PrevYield)

    Is this the result you expected?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.