Forum Discussion
Accumulate Measure within a table
Hi Anonymous
Maybe you have solved this problem. If so, can you share your solution here?
If not, my idea is that you could add an index column for Articels so that each Articel has a unique index number. Then we can use index number to refer to a specific articel to get its value. You can add an Index column in Power Query (Add column > Index column). Or if there are not many articels, you can also use DAX's SWITCH function to do it. And you get it like below
| Articel | Index |
|
Cheese A |
1 |
| Cheese B | 2 |
| Snack A | 3 |
| Snack B | 4 |
Then create a simple measure for number of deliveries, e.g. Number of deliveries = COUNT('tablename'[deliverycolumn])
I use COUNT for example as I don't know much about your data. You can change it per your need.
And create another measure to get its next row data.
Number of deliveries next =
VAR __index =
SELECTEDVALUE ( 'tablename'[Index] )
RETURN
CALCULATE (
[Number of deliveries],
ALL ( 'tablename' ),
'tablename'[Index] = __index + 1
)
At last, create the third measure to get the result.
Substraction of deliveries = [Number of deliveries] - [Number of deliveries next]
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.