Forum Discussion

BarryWhitelaw's avatar
BarryWhitelaw
Regular Visitor
1 year ago
Solved

Simple Matrix with Variance

HI there   I am a very new user to Power Bi, and struggling with something I thought must be a simple visualization.   For my data I need to show a matrix, years in the columns and months in the ...
  • pankajnamekar25's avatar
    1 year ago

    Hello BarryWhitelaw 

     

    Try these measure

    1.Total Spend = SUM('Table'[Spend])


    2.Previous Year Spend =
    CALCULATE(
    [Total Spend],
    SAMEPERIODLASTYEAR('Table'[Date])
    )

     

    3.Variance =
    [Total Spend] - [Previous Year Spend]


    4.Variance =
    VAR Curr = [Total Spend]
    VAR Prev = [Previous Year Spend]
    RETURN
    IF(
    NOT ISBLANK(Curr) && NOT ISBLANK(Prev),
    Curr - Prev
    )

     


    If my response helped you, please consider clicking
    Accept as Solution and giving it a Like 👍 – it helps others in the community too.


    Thanks,


    Connect with me on:

    LinkedIn