Forum Discussion

davidr's avatar
davidr
Frequent Visitor
6 years ago
Solved

Comparing the same month from last year

Hello,

 

I need to calculate the percentage difference of the 'Ratio' column (Column B) for the same month from last year.

 

For example: Comparing the 'Ratio' from 202007 (10) to 201907 (11) would be a 9.5% Difference.

 

Any help would be appreciated. Many Thanks.

 

YYYYRatioDate
202007101/07/2020
202006121/06/2020
201907111/07/2019
201906151/06/2019
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi davidr 

    Create a new column as below

     

    _LOOK =
    var _val = LOOKUPVALUE('Table'[Ratio], 'Table'[YYYY], FORMAT(left('Table'[YYYY],4),"####")-1 & right('Table'[YYYY],2))
    //RETURN _val
    RETURN if(ISBLANK(_val),BLANK(),(_val-'Table'[Ratio])/_val)
     
    Below is the Output, I don't see 9.5%, you may change the calculation in the above column creation dax formula marked in blue to achieve your desired result.

     

5 Replies