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

A simple question, for a newbi user

Hey there,

i somehow with the help of the internet managed to get the maximum value of the sum by a category, followed by that scrpit:

max value = MAXX(SUMMARIZE(Products, Products[Category_Name], "rev", SUM(Products[rev])), [rev])
and im now trying to get the category name of that measure, and i have no idea how to do it.
Un1111titled.png
   that is the value that i got, and and i want to see which category it is.
thanks!!! 🙂
1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @Anonymous 

Maybe not the best solution but should work

create a rank measure

RankMeasure = RANKX(ALL(Products[Category_Name]),CALCULATE(SUM(Products[rev])),,DESC)

then your desired

TopCategoryMeasure = calculate(
FIRSTNONBLANK(Products[Category_Name],1), 
FILTER(ALL(Products[Category_Name]),[RankMeasure]=1)
)

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

4 REPLIES 4
Stachu
Community Champion
Community Champion

Can you add sample tables (in format that can be copied to PowerBI) from your model with anonymised data? Like this (just copy and paste into the post window).

Column1 Column2
A 1
B 2.5

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Anonymous
Not applicable

Un1111titled.png

here is the example of the data i work with,

thanks

az38
Community Champion
Community Champion

Hi @Anonymous 

Maybe not the best solution but should work

create a rank measure

RankMeasure = RANKX(ALL(Products[Category_Name]),CALCULATE(SUM(Products[rev])),,DESC)

then your desired

TopCategoryMeasure = calculate(
FIRSTNONBLANK(Products[Category_Name],1), 
FILTER(ALL(Products[Category_Name]),[RankMeasure]=1)
)

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

love u 

thanks!

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.

Top Solution Authors