Forum Discussion

JonathanGibbs's avatar
JonathanGibbs
Regular Visitor
3 years ago
Solved

Count of Counts

I have a 'Count of counts' DAX query. Sample table tVisits: Year  Person SiteVisited 2021 A          S1 2021 A          S2 2021 A          S1 2021 B          S3 2021 C          S2 2021 C     ...
  • JonathanGibbs's avatar
    3 years ago

    Greg_Deckler  No, that's the point - any slicer or filter settings applied to the underlying table (tVisits) don't propagate through to the derived table (tSummary).

     

    But I think I've found the answer myself - use multiple 'group by' clauses in the SUMMARIZE instructions, then apply the same slicers/filters to the derived table as to the source. So I can pass through the Year like this:

    tSummary =
    SUMMARIZE(
       SUMMARIZE(
          tVisits,
          tVisits[Person],
          tVisits[Year],
          "DistinctSites",
          DISTINCTCOUNT(tVisits[SiteVisited])
       ),
       [DistinctSites],
       [Year],
       "CountVisitors",
       DISTINCTCOUNT(tVisits[Person])
    )

     

    Not sure if this is the most elegant solution, but it works..