Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Subtraction and Percentage difference

Hi everyone.  I have "net shipmant" column from 2019 and "net shipmnat" from 2018. "variance order" is my 2019 and 2018 filter.   now I want to create 2 columns wich will be calculate 1. N...
  • v-cherch-msft's avatar
    v-cherch-msft
    7 years ago

    Hi Anonymous 

    You may create two measures to get the value.

    Percentage =
    VAR _2019 =
        CALCULATE (
            SUM ( Table1[NetShipments] ),
            FILTER ( Table1, Table1[Year] = 2019 )
        )
    VAR _2018 =
        CALCULATE (
            SUM ( Table1[NetShipments] ),
            FILTER ( Table1, Table1[Year] = 2018 )
        )
    RETURN
        IF (
            ISFILTERED ( Table1[Year] ),
            SUM ( Table1[NetShipments] ),
            FORMAT ( DIVIDE ( _2019 - _2018, _2018 ), "Percent" )
        )
    

    Regards,