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())
))
Hi HollyMusgrove,
This is just based on the images and the DAX measures you have shared, it looks like the relationship between Activity_info_fact and UnpivotedAttendances is unidirectional and the fact table is filtering attendance table. On the visual, when you filter the table, the card doesn't get filtered due to the unidirectional relationship.
I hope this solves your problem, if not, can you please share a full view of the model and visual table.
If my answer helped you solve the problem, please consider accepting it as the solution and help other members to use the same solution in same/similar situations.