Forum Discussion
Jcastill
6 years agoRegular Visitor
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
- 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)Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
V-lianl-msft
6 years agoCommunity Support
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)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.