cancel
Showing results for
Did you mean:
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?

1 ACCEPTED SOLUTION
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.
3 REPLIES 3
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.
Frequent Visitor

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

Frequent Visitor

Also this is my data model

Announcements