Forum Discussion

gbarr12345's avatar
gbarr12345
Post Prodigy
2 years ago
Solved

Percentage difference measure

Hi,   I have a measure to get the percentage difference for year 1 between depletion and exports.   I'm looking to have this measure to do the percentage difference for year 2, year 3 and year 4 ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi gbarr12345 ,

    Ritaf1983 Thanks for your concern about this case!
    And gbarr12345 , the problem should be with these two measures of yours:


    Here I build a sample data myself:

    Measures:

    Depletion First 12 Months = 
    CALCULATE(
        SUM('Table'[Depletion]),
        ALL('Table'),
        MONTH('Table'[Date]) >= 1 && MONTH('Table'[Date]) <= 12 && 'Table'[Year] IN VALUES('Table'[Year])
    )
    Exports First 12 Months = 
    CALCULATE(
        SUM('Table'[Exports]),
        ALL('Table'),
        MONTH('Table'[Date]) >= 1 && MONTH('Table'[Date]) <= 12 && 'Table'[Year] IN VALUES('Table'[Year])
    )
    Year 1 % difference = 
    VAR Dep = [Depletion First 12 Months]
    VAR Exports = [Exports First 12 Months]
    RETURN
    IF(
        Exports <> 0,
        DIVIDE(Dep, Exports, 0),
        BLANK()
    )

    And the final output is as below:



     

    If there is still a problem, could you please provide your sample data, and the DAX you created for these two measures, please!

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