Forum Discussion

TA9's avatar
TA9
Frequent Visitor
3 years ago
Solved

counting occurrences

Hi,   I have two fields ID and outcome. Each ID can have more than one outcome and each outcome is on a separate row (example below)   ID Outcome 1 A 1 B 2 C 3 A 3 C 4 ...
  • Jihwan_Kim's avatar
    3 years ago

    Hi,

    I suggest ( and agree with you) having an additional table like below.

    Please check the below picture and the attached pbix file whether it suits your requirement.

     

     

     

     

    Number of Occurreces measure: =
    VAR _newtable =
        ADDCOLUMNS ( DISTINCT ( Data[ID] ), "@count", CALCULATE ( COUNTROWS ( Data ) ) )
    VAR _filtertable =
        FILTER ( _newtable, [@count] = MAX ( 'Axis'[Axis] ) )
    RETURN
        COUNTROWS ( _filtertable )