Forum Discussion
running total
- 9 years ago
Let me know if this solves your problem. I find it easier to write the code based on your data:
https://www.dropbox.com/s/b2iv4gtmoofx5kb/Running%20total.pbix?dl=0
Have fun with DAX!
Alberto Ferrari
http://www.sqlbi.com
Is the value of Ticket allotted per day the same for all the rows in the same day? If so, you can do as follows:
Allotted Running Total :=
VAR CurrentDay = MAX ( Table[Day] )
CALCULATE (
SUMX (
SUMMARIZE (
Table,
Table[Day],
Table[Ticket allotted per day]
),
Table[Ticket allotted per day]
),
Table[Day] <= CurrentDay
)If, on the other hand, the value might be different for the same day, then this code will result in a wrong result (but, at this point, you have a modeling issue).
That said, it would be better to store the "ticket alloted per day" in a table containing one row per day, in that case the solution would be a much better one.
I have a table with ticket allocated per day month wise.
This number comes from a monthly allocated ticket / number of days in month. So I created a monthwise table having ticket allocated per day