Forum Discussion
Improper Aggregation based on Slicer Selection (Descending Cumulative Total)
- 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.
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 + ExpiredCount
Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.