cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bar
Frequent Visitor

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

Hi @Bar 

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 🙂

Proud to be a Super User!

Bar
Frequent Visitor

Un1111titled.png

here is the example of the data i work with,

thanks

Hi @Bar 

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

Bar
Frequent Visitor

love u 

thanks!

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors