Forum Discussion
djkoenig
Helper II
1 year agoImproper Aggregation based on Slicer Selection (Descending Cumulative Total)
Hello Experts, I'm quite confused. I have calculated a descending running total like so: DescendingCumulativeSum =
VAR MaxDate = MAX('Patent List'[Earliest Priority Date])
VAR TotalCount ...
- Anonymous1 year ago
Hi djkoenig
The problem with aggregating the DescendingCumulativeSum measure in the matrix after applying the slicer is due to the ALL() function used in DAX removing all the filters from the data table 'Patent List', please use the ALLSELECTED() function instead to preserve the effect of the external filters.
DescendingCumulativeSum = VAR MaxDate = MAX('Patent List'[Earliest Priority Date]) VAR ExpiredCount = CALCULATE(COUNT('Patent List'[ID]), 'Patent List'[Dead or Alive] = "DEAD") VAR TotalCount = COUNTROWS( FILTER( ALLSELECTED('Patent List'), 'Patent List'[Dead or Alive] = "DEAD" ) ) VAR CurrentCount = CALCULATE( COUNTROWS('Patent List'), FILTER( ALLSELECTED('Patent List'), 'Patent List'[Earliest Priority Date] <= MaxDate && 'Patent List'[Dead or Alive] = "DEAD" ) ) RETURN TotalCount - CurrentCount + ExpiredCountBest Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
djkoenig
Helper II
1 year agoOh, I was doing something quite goofy... Asking it to filter based on slicer selection, then turning around and immediately stripping the filter context in the measue.
Thanks for reteaching me the ALLSELECTED lesson Anonymous, much appreciated 🙂