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

How to filter on topN for each category

Hi there,

 

I think I have a straight forward question that many of you probably might answer in a matter of seconds.
But somehow, it doesn't seem like I can get it to work.

I have a matrix (see below) showing the top places, their names and what movies they were in.

 

What I would like to do is to filter in a way so that I only get the place with the highest total for each movies.

So I expect to have only 8 lines (8 different movies) with each showing the place that was most often used in that specific movie.

 

How in the world do I manage to get that?

 

Thanks in advance.

Capture.PNG

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @CHFarver ,

 

You could either create a measure to get the highest total for each movies and filter total places = higest total, or create a measure to rank the total places for each movies and filter rank = 1.

For example:

measure 1 =
var _max_each_movies = MAXX(ALLEXCEPT('Table','Table'[Movie]),[Total Places])
return
IF([Total Places] = _max_each_movies,[Total Places],BLANK())
Or

measure 2 = RANKX(ALLEXCEPT('Table','Table'[Movie]),[Total Places],,DESC)
Then add measure2 to visual filter set value = 1.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @CHFarver ,

 

You could either create a measure to get the highest total for each movies and filter total places = higest total, or create a measure to rank the total places for each movies and filter rank = 1.

For example:

measure 1 =
var _max_each_movies = MAXX(ALLEXCEPT('Table','Table'[Movie]),[Total Places])
return
IF([Total Places] = _max_each_movies,[Total Places],BLANK())
Or

measure 2 = RANKX(ALLEXCEPT('Table','Table'[Movie]),[Total Places],,DESC)
Then add measure2 to visual filter set value = 1.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
CHFarver
Frequent Visitor

Total Places measure is a simple count of the places in the Dialogue table

CHFarver
Frequent Visitor

Also this is my data model

Capture.PNG

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors