Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
SG-01
Helper I
Helper I

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 10
pratyashasamal
Memorable Member
Memorable Member

Hi @SG-01 ,
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




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@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.

@SG-01 , You can try this as well :-
MaxTest = MAXX(VALUES('DimensionTableName'[Category]),MAX([Values]))
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




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@pratyashasamal If I use this one, I get for every category the highest value of sum. That is not what I want. I need for each team only 1 category, not all of them with the highest values. How can I do that?

Try TOPN function once 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





On the measure? That's not possible in Power BI. Or I can use TOPN for category or team but that does not seem to work.

Anonymous
Not applicable

Hi @SG-01 ,

 

According to your statement, I think in Team2, B and D should both be the category with highest value.

Measure:

Category with highest value in each Team =
VAR _Step1 =
    FILTER (
        ADDCOLUMNS (
            'Table',
            "Sum each Category", CALCULATE ( MAX ( 'Table'[Value] ), ALLEXCEPT ( 'Table', 'Table'[Team] ) )
        ),
        [Value] = [Sum each Category]
    )
RETURN
    CONCATENATEX ( _Step1, [Category], "," )

Result is as below.

vrzhoumsft_0-1689578508598.png

Best Regards,
Rico Zhou

 

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

 

@Anonymous Hi there. This is a good solution, however I need the SUM of "Value" which is the highest for each category. Not the single value of "Value" which is the highest. Do you understand?

@Anonymous Hi there, do you have a new solution? Because I think your solution was in a good direction.

Hi @SG-01 ,
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




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors