Forum Discussion
Measure - Marginal different in a column
Hi, I have a measure to sum up the "Total Cost" (ASC) by its groups, may I know could I add one measure to calculate their %different comparing to upper value. Great thanks!
e.g. For group 2: 2970/2500-1 = 19%
| Group | Total Cost | Change% |
| 1 | 2500 | |
| 2 | 2970 | 19% |
| 3 | 3450 | 16% |
| 4 | 4100 | 19% |
| 5 | 4860 | 19% |
ngct1112 , try like
This = CALCULATE([Total Cost], FILTER(ALLSELECTED('Table'),'Table'[Group]=max('Table'[Group])))
Last = CALCULATE([Total Cost], FILTER(ALLSELECTED('Table'),'Table'[Group]=max('Table'[Group])-1))diff = divide([This],[Last])-1
But it will work better when group is in a separate diemenion/master table
2 Replies
- amitchandakSuper User
ngct1112 , try like
This = CALCULATE([Total Cost], FILTER(ALLSELECTED('Table'),'Table'[Group]=max('Table'[Group])))
Last = CALCULATE([Total Cost], FILTER(ALLSELECTED('Table'),'Table'[Group]=max('Table'[Group])-1))diff = divide([This],[Last])-1
But it will work better when group is in a separate diemenion/master table
- FowmySuper User
ngct1112
Please add this as a measure:Cost Change % = VAR _LASTGRP = MAX(Table9[Group])-1 VAR _LASTACOST = CALCULATE( [Total Cost], Table9[Group] = _LASTGRP) RETURN IF( ISFILTERED('Table9'[Group]), DIVIDE( [Total Cost] - _LASTACOST, _LASTACOST ) )________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂