Forum Discussion
How to create a running total column from a certain date range in DAX
- 2 years ago
Hi, user8289
Replace the formula with the following:
Running total = Var _Sum=CALCULATE( SUM('table'[size]), FILTER(ALL('table'), 'table'[Date] <= SELECTEDVALUE('table'[date]) &&[Date]>=MIN('Date'[Date])&&[Date]<=MAX('Date'[Date] ))) Return IF(SELECTEDVALUE('Table'[Date])>=MIN('Date'[Date])&&SELECTEDVALUE('Table'[Date])<=MAX('Date'[Date]),_Sum,BLANK())Is this the result you expect? Please see the attached document.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, user8289
You can try the following methods.
Create a new date table.
Measure:
Running total =
Var _Sum=CALCULATE( SUM('table'[size]),
FILTER(ALL('table'[Date]), 'table'[Date] <= max('table'[date])
&&[Date]>=MIN('Date'[Date])&&[Date]<=MAX('Date'[Date]
)))
Return
IF(SELECTEDVALUE('Table'[Date])>=MIN('Date'[Date])&&SELECTEDVALUE('Table'[Date])<=MAX('Date'[Date]),_Sum,BLANK())
Is this the result you expect? Please see the attached document.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- user82892 years agoNew Member
Thanks for your reply and sample data. However this did not work for me. Your example seeems to have the required functionality however when applied to my data it gives the result below:
- v-zhangti2 years ago
Community Support
Hi, user8289
Replace the formula with the following:
Running total = Var _Sum=CALCULATE( SUM('table'[size]), FILTER(ALL('table'), 'table'[Date] <= SELECTEDVALUE('table'[date]) &&[Date]>=MIN('Date'[Date])&&[Date]<=MAX('Date'[Date] ))) Return IF(SELECTEDVALUE('Table'[Date])>=MIN('Date'[Date])&&SELECTEDVALUE('Table'[Date])<=MAX('Date'[Date]),_Sum,BLANK())Is this the result you expect? Please see the attached document.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- user82892 years agoNew Member
You are awsome!! Thank you thats exactly what I wanted.....