Forum Discussion
HEW
7 years agoHelper III
Difference between 2 columns in a Matrix Table
Hi. I am trying to calculate the difference between 2 columns i Desktop. The value is a measure and the columns are one field, pls. see below. I have tried to create a measure but with no luck...
v-frfei-msft
7 years agoCommunity Support
HEW
7 years agoHelper III
Hi Frank.
Is it really so complicated? I'll try and adapt the formula to my data and hope it works :smileyhappy: Thanks.
Br. Helen
- v-frfei-msft7 years agoCommunity Support
Hi HEW,
I made one sample for your reference.
1. Enter the data as your description and create a calculated table.
Table = SUMMARIZE(Table1,Table1[Month],Table1[mo],Table1[Year],"sum",SUM(Table1[Amount]))
2. Create a calculated column in Table.
diff = var prevalue = CALCULATE(FIRSTNONBLANK('Table'[sum],1), FILTER('Table',('Table'[Year]= (EARLIER('Table'[Year])-1)) && 'Table'[mo]= EARLIER('Table'[mo]))) return IF(ISBLANK(prevalue), BLANK(),'Table'[sum]-prevalue)3. Then we can get the result as we excepted.
For more details, please check the pbix as attached.
Regards,
Frank