Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to find a group with highest value

Community,

 

I am a new learner in Power BI. I want to present a card to show a group with highest summarized value. For example, as the data showed below, the sum value of group A is 14, B is 12, C is 12. I want to present number and the group with highest sum value(which here is A  14) in a card. How can I achieve this?

NameGroupValue
aaA2
abA3
acA4
adA5
afB2
dvB1
ccB3
cdC4
eeC8

 

Thanks for the help

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Anonymous 

     

    Go with this:

     

    Measure = 
    var TableA= SUMMARIZE('Table','Table'[Group],"Sumbygroup", SUM('Table'[Value]))
    Var Maxgroup = MAXX(FILTER(TableA,[Sumbygroup]=MAXX(TableA,[Sumbygroup])),[Group])
    Var Maxsum = MAXX(FILTER(TableA,[Sumbygroup]=MAXX(TableA,[Sumbygroup])),[Sumbygroup])
    Return CONCATENATE(Maxgroup,Maxsum)

     

     

    Paul Zheng
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Hello Anonymous 

     

    Try something like this:

     

    Highest =
      VAR __Table = 
        SUMMARIZE(
          'Table',
          [Group],
          "__Value",SUM('Table'[Value])
        )
      VAR __Max = MAXX(__Table,[__Value])
    RETURN
      MAXX(FILTER(__Table,[__Value] = __Max),[Group])

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous 

     

    Go with this:

     

    Measure = 
    var TableA= SUMMARIZE('Table','Table'[Group],"Sumbygroup", SUM('Table'[Value]))
    Var Maxgroup = MAXX(FILTER(TableA,[Sumbygroup]=MAXX(TableA,[Sumbygroup])),[Group])
    Var Maxsum = MAXX(FILTER(TableA,[Sumbygroup]=MAXX(TableA,[Sumbygroup])),[Sumbygroup])
    Return CONCATENATE(Maxgroup,Maxsum)

     

     

    Paul Zheng
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.