Forum Discussion

HollyMusgrove's avatar
HollyMusgrove
Frequent Visitor
4 months ago
Solved

Filter a card using a table

I know there's a few posts around this but I can't follow them in relation to my own data structure. I have this page in my report - if I click on the table rows it filters the graph but not the car...
  • HollyMusgrove's avatar
    4 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())
    ))