I'm traying to calculate cumulative sum for a Project until date selected in the filter. My filter date is a drop down list and it shows like this for example: July 2020 Aug 2020 .....
I have 2 tables: factworkinghours table and dimdates table. enter image description here
and I want to calculate cumulative sum of total hours per Project. for example if I have project #714 and I know this project took place from Jan 2020 until Fab 2020:
I want to get those result:
- If my filter is on jan 2020 - I want to get 15.5 hours
- If my filter is on fab 2020- I want to get 20.5 hours ( 15.5+5)
- If my filter is on Mar 2020- I want to get 20.5 hours since the Project ended and no total hours was added.
- If my filter is on Dec 2019 I want to get 0 since the project hasn't started yet.
I tried to do write this dax but it's not working:
test hadar = VAR _maxdate = CALCULATE ( MAX ( dimDates[date]) ) // max date of the selected dates return CALCULATE ( [sum of total hours], FILTER ( all( dimDates), dimDates[date] <= _maxdate ))
hope this is understood ... Thanks!