Forum Discussion

afaherty's avatar
afaherty
Icon for Helper V rankHelper V
4 years ago
Solved

Counts & Percentages for Non-Numerical Data

Hello, Can someone help me figure this out?  This is all fake data but is set up in the same manner as my real data. This is unpivoted:   ID Graduation Year Majors City 1 2020 Educatio...
  • smpa01's avatar
    smpa01
    4 years ago

    afaherty  please give this a try and let me know if this gives you what you need

     

    Measure = 
    VAR _numerator =
        DISTINCTCOUNT ( 'Table 1'[ID] )
    VAR _selectedCity =
        ALLSELECTED ( 'Table 1'[City] )
    VAR _denominator =
        CALCULATE (
            DISTINCTCOUNT ( 'Table 1'[ID] ),
            TREATAS ( _selectedCity, 'Table 1'[City] ),
            REMOVEFILTERS ( 'Table 1'[Majors] )
        )
    RETURN
        DIVIDE ( _numerator, _denominator )