Forum Discussion

Jon54's avatar
Jon54
Frequent Visitor
3 years ago
Solved

Filtering table of distinct counts

Hello, I have a dataset with patient visits to a clinic by date. I have been able to create a measure that counts how many days each patient visits the clinic in a year and totals that number for al...
  • Jon54's avatar
    Jon54
    3 years ago

    v-jingzhang thanks, appreciate you coming back to me. It is the syntax I am struggling with. What I really need is a count of the patients who have multiple visits. If I make the following change it deson't work. Why would that be?

    Distinct visits2 = VAR _table =
        SUMMARIZE (
            'Backing data',
            'Backing data'[Patient],
            "countOfVisitDates", DISTINCTCOUNT ( 'Backing data'[Attendance Date] )
        )
    RETURN
        SUMX ( FILTER ( _table, [countOfVisitDates] > 1 ), [Patient] )
  • Jon54's avatar
    Jon54
    3 years ago

    v-jingzhang Hello, I changed SUMX to COUNTX. I now get the number I want. Thanks. This has been driving me mad