Forum Discussion

sharmisaranga09's avatar
2 years ago
Solved

Find maximum occurred item for each category

Hi, I have a question and answer columns in my table, I want to find the count of unique answers for each questions and get the maximum count answer for each question Expected result is, find...
  • Greg_Deckler's avatar
    Greg_Deckler
    2 years ago

    sharmisaranga09 The measure form is:

    Max count Answered (measure) =
      VAR __Question = MAX( [Question] )
      VAR __Table = SUMMARIZE( FILTER( ALL( 'Table' ), [Question] = __Question ), [Answer], "__Count", COUNTROWS( 'Table' ) )
      VAR __Max = MAXX( __Table, [__Count] )
      VAR __Result = MAXX( FILTER( __Table, [__Count] = __Max ), [Answer] )
    RETURN
      __Result