cancel
Showing results for
Did you mean:
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.
that is the value that i got, and and i want to see which category it is.
thanks!!! 🙂
1 ACCEPTED SOLUTION
Super User

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)``

``````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
4 REPLIES 4
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

Thank you for the kudos 🙂

Proud to be a Super User!

Frequent Visitor

here is the example of the data i work with,

thanks

Super User

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)``

``````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
Frequent Visitor

love u

thanks!

Announcements