Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Create Matrix column to show % difference between years

I have a matrix in power BI Desktop like the following one (real data deleted due to confidentiality reasons):  To build this table I used the following DAX:  Valores P&L Cuenta Explo...
  • Samarth_18's avatar
    2 years ago

    Hi Anonymous ,

     

    You could try below measure:-

    CurrentYearValue = 
    CALCULATE(
        [Valores P&L Cuenta Explotación],
        FILTER(
            ALL('DIM Calendar'),
            'DIM Calendar'[Year] = SELECTEDVALUE(Years[Value])
        )
    )
    
    PreviousYearValue = 
    CALCULATE(
        [Valores P&L Cuenta Explotación],
        FILTER(
            ALL('DIM Calendar'),
            'DIM Calendar'[Year] = SELECTEDVALUE(Years[Value]) - 1
        )
    )
    
    PercentChange = 
    IF(
        ISBLANK([PreviousYearValue]),
        BLANK(),
        DIVIDE([CurrentYearValue] - [PreviousYearValue], [PreviousYearValue], 0)
    )