Forum Discussion
Using Running Total in Calculations
Hi bullius,
Did you use any slicers or filters?
Could you please post a sample in text mode? According to my limited test, the formula should work.
Could you please replace "ALLSELECT" with "ALL"? Just for test.
Best Regards!
Dale
Dim_Calendar is connected to Fact_OccasionsComp. So, if I filter Dim_Calendar, it filters Fact_OccasionsComp, which affects the running total formula because I am using ALLSELECTED, rather than ALL. However, when I use ALL, it bypasses the other filters I have in the formula, ie,
Fact_OccasionsComp[CompOccasion] = "Established"
Fact_OccasionsComp[CompOccasion] = "Closed", Fact_OccasionsComp[Date] = null
which changes the result.
If you can think of a way to do this using a measure, that would be useful still, but I think I am going to resort to creating a separate table summarizing the running total by year, then use that to calculate my "Desired Result" column.
Thanks for your help!
- v-jiascu-msft9 years agoMicrosoft Employee
Hi bullius,
I wonder if "Allexcept" would help. Maybe you could try this one if no other filter exists.
Running Total = CALCULATE ( DISTINCTCOUNT ( Fact_OccasionsComp[CompanyID] ), Fact_OccasionsComp[CompOccasion] = "Established", FILTER ( ALLEXCEPT ( Fact_OccasionsComp, Fact_OccasionsComp[CompOccasion] ), Fact_OccasionsComp[Date] <= MAX ( Dim_Calendar[Date] ) ) ) - CALCULATE ( DISTINCTCOUNT ( Fact_OccasionsComp[CompanyID] ), Fact_OccasionsComp[CompOccasion] = "Closed", FILTER ( ALLEXCEPT ( Fact_OccasionsComp, Fact_OccasionsComp[CompOccasion] ), Fact_OccasionsComp[Date] <= MAX ( Dim_Calendar[Date] ) && Fact_OccasionsComp[Date] = null ) )Best Regards!
Dale
- bullius9 years agoHelper V
v-jiascu-msft - good suggestion. I haven't used that function before.
Unfortunately, it didn't work in this case. I added all the columns I wanted to be able to filter, excluding the date column. The problem is if I exclude the date column, I only get one result, regardless of the year. And if I include the date column as one I want to be able to filter, we're back to the original problem.
Thanks!
- v-jiascu-msft9 years agoMicrosoft Employee