Forum Discussion
Calculate Remaining Items
- 5 years ago
Here is a measure expression to do it. I called your table Used (so you'll need to change that to your actual table name), and I renamed your "#" column to "Num". To get your 2nd measure, just change the return as indicated in the comment.
Rem =
VAR vInitial = 100
VAR vThisNum =
MIN ( Used[Num] )
VAR vUsedSoFar =
CALCULATE (
SUM ( Used[Used] ),
ALL ( Used ),
Used[Num] <= vThisNum
)
RETURN
vInitial - vUsedSoFar
// for Rem % use DIVIDE(vInitial - vUsedSoFar, vInitial)Pat
Here is a measure expression to do it. I called your table Used (so you'll need to change that to your actual table name), and I renamed your "#" column to "Num". To get your 2nd measure, just change the return as indicated in the comment.
Rem =
VAR vInitial = 100
VAR vThisNum =
MIN ( Used[Num] )
VAR vUsedSoFar =
CALCULATE (
SUM ( Used[Used] ),
ALL ( Used ),
Used[Num] <= vThisNum
)
RETURN
vInitial - vUsedSoFar
// for Rem % use DIVIDE(vInitial - vUsedSoFar, vInitial)
Pat
- Anonymous5 years agoNot applicable
Hi Pat,
The solution works just fine.
Is there a simple way to keep the results blank if the used value is blank.