Forum Discussion
Running totals backwards
- Anonymous2 years ago
Hi gvlado ,
As Nithinr said, it is possible to do what you need to do based on this DAX code, here are my thoughts and additions.
First create a table.
A slight change to Nithinr's DAX code will give you the results you need.
MEASURE = VAR _A = CALCULATE ( SUM ( 'Table'[IN-OUT] ), FILTER ( ALL ( 'Table' ), 'Table'[Date] >= MIN ( 'Table'[Date] ) ) ) VAR _AA = _A + 900 RETURN _AABest Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 2 years agoSmall correction 900 -> 1000
And types of columns must be defined
---- BOMeasure----------
Measure =VAR _A = CALCULATE(SUM('Table'[IN-OUT]),FILTER(ALL('Table'),'Table'[Date] >= MIN('Table'[Date])))VAR _AA = _A + 1000RETURN_AA--- EOMEasure---
Hi,
For closing inventory on 1/3/2024 to be 900, the closing inventory on 29/2/2024 should be 1000. Why is it 890?
It is because receiving (IN=10) and deliveiring (OUT=20) -> means that this day was inventory smaller for 10 (-10). So, I have in and out for every day. Only for last day (1/3/2024) there is data fon inventory at the end of the day. It means calculation of inventory starts from 1000.
- Ashish_Mathur2 years ago
Super User
Hi,
I have solved a similar problem in the attached PBI files. Please review them and adapt them to your setup.