Forum Discussion

user35131's avatar
user35131
Icon for Helper III rankHelper III
5 years ago
Solved

Get average of grouped second column based on values within first column

I would like to get the average of counts of values within a column broken up by group defined by a second column Sport Method Basketball  Ball Basketball Ball Baseball Ball Baseb...
  • Jos_Woolley's avatar
    5 years ago

    Hi,

    Average =
    VAR MyTable =
        SUMMARIZE (
            'Table',
            'Table'[Sport],
            'Table'[Method],
            "Count", COUNTROWS ( 'Table' )
        )
    RETURN
        AVERAGEX ( MyTable, [Count] )

    Regards

  • Fowmy's avatar
    5 years ago

    user35131 

    Create a measure as follows and add to a table visual with Method

    Average Sport = 
    DIVIDE(
        COUNTA(Table5[Sport]),
        DISTINCTCOUNT(Table5[Sport])
    )