Forum Discussion

Jcastill's avatar
Jcastill
Regular Visitor
6 years ago
Solved

subtraction same colum

Hello Community, someone can help me. I am nes in BI how can I do a subtract between 2 values on the same column (Matrix chart) here my data in the matrix cha    
  • V-lianl-msft's avatar
    6 years ago

    Hi Jcastill ,

     

    You need a calendar table and create relationships with the fact table.

    Then create measure like this:

    Subtract Previous Year = 
    
    var VarThis = SUM('Table'[value])
    
    var LastYear =CALCULATE(SUM('Table'[value]),dateadd('Table 2'[date],-1,YEAR))
    
    return
    
    IF(
    VarThis - LastYear = 0, VarThis, VarThis - LastYear)

    Sample .pbix

     

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