Forum Discussion
Filter a card using a table
- 6 months ago
The issue was that some activities had an attendance of 0 so I needed to explicit about filtering that out:
Total Activities with Filtering =
// Check whether there is filtering on attendance groups
VAR _NoSelection =
(ISBLANK(SELECTEDVALUE(attendance_groups_DIM[AgeGroup])) &&
ISBLANK(SELECTEDVALUE(attendance_groups_DIM[TypeGroup])))RETURN
CALCULATE(
[Total Activities],
// If there is filtering, count activities only where the count of attendances for the relevant group is not 0
// It's not strictly necessary to wrap "UnpivotedAttendances_FACT[Value] <> 0" in an IF statement, but without it, it won't count activities with 0 attendance (and it looks like there is one such activity)
FILTER(UnpivotedAttendances_FACT,
IF(_NoSelection = FALSE,
UnpivotedAttendances_FACT[Value] <> 0,
TRUE())
))
The issue was that some activities had an attendance of 0 so I needed to explicit about filtering that out:
Total Activities with Filtering =
// Check whether there is filtering on attendance groups
VAR _NoSelection =
(ISBLANK(SELECTEDVALUE(attendance_groups_DIM[AgeGroup])) &&
ISBLANK(SELECTEDVALUE(attendance_groups_DIM[TypeGroup])))
RETURN
CALCULATE(
[Total Activities],
// If there is filtering, count activities only where the count of attendances for the relevant group is not 0
// It's not strictly necessary to wrap "UnpivotedAttendances_FACT[Value] <> 0" in an IF statement, but without it, it won't count activities with 0 attendance (and it looks like there is one such activity)
FILTER(UnpivotedAttendances_FACT,
IF(_NoSelection = FALSE,
UnpivotedAttendances_FACT[Value] <> 0,
TRUE())
))