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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
maciabit
Frequent Visitor

Help! Best by category dinamically using DAX (.pbix attached)

Hello everyone!

 

I am asking for your help because, despite searching, I cannot find a way to create this DAX function. I uploaded here a .PBIX FILE EXAMPLE.
Simplified version of the problem follows.


I'm in this situation: 

 

image.png

 

 And want to obtain this:

 

image.png

 

I have a table containing store, category and a mymeasure (a measure).

For each category I need to find the best store. The calculation of the best store must be dynamic on the selected month, but must not consider any filters on the category or store.

I was able to calculate the value the best measure of that category. This is how i made value_highest_in_category:

 

value_highest_in_category =
CALCULATE(
    MAXX(
        SUMMARIZE('Data', 'Data'[store], "myMeasure", [measure]), [measure]
    ),
    ALLEXCEPT('Data','Data'[month]), 'Data'[category] = MAX('Data'[category])
)

 

but I just can't extract the name of the corresponding store.

I thank anyone who can help me!

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

Measure 2 = VAR _vm=[value_highest_in_category] RETURN MAXX(FILTER(ALL(Data[store]),[measure]=_vm),'Data'[store])

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

Measure 2 = VAR _vm=[value_highest_in_category] RETURN MAXX(FILTER(ALL(Data[store]),[measure]=_vm),'Data'[store])

Thank you so much!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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