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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Maximum value of categorized SUM

Hi,

What I'm trying to do seems easy, but I can't find a way to get it working. 

I have a table with multiple categories, where a category could exist multiple times, and the amount:

CategoryAmount
a5
b10
c2
a3
b20
c9

 

I would like to create a DAX measure that shows me the category name of the category with the highest SUM of the values for that category. In this case the measure should just display: "b"

 * (10+20) is the higest sum * 

 

** As a reference:

When I create a table with the summarized value. I would like the top 1 category name in a Card visual, here value "b".

categories.PNG

 

Thanks in advance.

Jef

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can use an expression like below in your card visual.

rankCategory = 
CONCATENATEX(
    TOPN( 1,  ALL( 'Table'[Category] ), CALCULATE( SUM( 'Table'[Amount] ), ALL( 'Table'[Amount] ) ) ),
    'Table'[Category],
    "; "
)

Please see  the attached file for the ref

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

View solution in original post

3 REPLIES 3
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can use an expression like below in your card visual.

rankCategory = 
CONCATENATEX(
    TOPN( 1,  ALL( 'Table'[Category] ), CALCULATE( SUM( 'Table'[Amount] ), ALL( 'Table'[Amount] ) ) ),
    'Table'[Category],
    "; "
)

Please see  the attached file for the ref

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

Thanks. It is working perfect.

Anonymous
Not applicable

@Mariusz Thank you, this works indeed! 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.