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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.