Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Show highest values for each category

Hi, let's say I have the following data:

CategoryTeamValue
A15
B210
C315
D120
A25
B30
C115
D2

10

For each team I want to show the category where the SUM of value is the most. I want to show this in a graph. So team 1 has the most value in Category D, team 2 in Category D, team 3 in in Category C. The other categories must not be shown in the graph. Also the corresponding values needs to be shown in the graph. How can I do that?

 

10 Replies

  • Hi Anonymous ,
    Try this measure :-

    MaxTest = MAXX(VALUES('DimensionTableName'[Category]),[NameOfMeasureWhichSumsTheValues])
    Hope this was helpful.
    Thanks,
    Pratyasha Samal
    Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
    If you found this post helpful, please give Kudos C
    • Anonymous's avatar
      Anonymous
      Not applicable

      pratyashasamal Hi, thanks for your reply! This solution only looks at the maxium value of 'value'? Because I need the category where the SUM of value is the highest for each team.

      • pratyashasamal's avatar
        pratyashasamal
        Icon for Memorable Member rankMemorable Member

        Hi Anonymous ,
        You can use TOPN function to get the highest sum of sales value by category.
        For example :-

        EVALUATE
            TOPN (
                1,
                ADDCOLUMNS (
                    VALUES ( 'Product'[Product Category] ),
                    "@Sales Amount", [Sales Amount]
                ),
                [@Sales Amount],
                DESC
            )
        ORDER BY [@Sales Amount] DESC
        Example 2 :-
        TopN 2nd example = 
        TOPN(
            2,
            VALUES(DimProduct[Category]),
            CALCULATE(SUM(FactInternetSales[SalesAmount]))
        )


        You can refer to this link :-
        https://dax.guide/topn/
        Thanks,
        Pratyasha Samal
        Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
        If you found this post helpful, please give Kudos C