Forum Discussion

jiglow3501's avatar
jiglow3501
Frequent Visitor
7 years ago
Solved

difference between two values in same column

Year    T otal Sales       Difference in Sales from Last Year (should be result) 2014    0 2015   2.5                          2.5 2016   4.5                           2 2017   9                 ...
  • v-piga-msft's avatar
    7 years ago

    Hi jiglow3501

     

    Please create the calculated column with the formula below.

     

    Column =
    VAR temp =
        CALCULATE (
            MAX ( 'table'[Total Sales] ),
            FILTER ( 'table', 'table'[Year] = EARLIER ( 'table'[Year] ) - 1 )
        )
    RETURN
        IF ( 'Table'[Total sales] - temp = 0, BLANK (), 'Table'[Total sales] - temp )

    Then you will get the output below.

     

     

     

     

    Best Regards,

    Cherry