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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
jakubw
Regular Visitor

Sort a slicer by a dynamically generated measure

I have a problem with sorting a slicer in Power BI desktop.

 

Let's say I have a table with movies, that feeds the slicer in question.

 

movies:

TitleBox officeYear
Avengers: Endgame $2,797,800,5642019
 Avatar$2,789,958,5072009
Titanic $2,187,463,9441997
 Star Wars: The Force Awakens$2,068,223,6242015
 Avengers: Infinity War$2,048,359,7542018

 

And another table with their ratings, related by the Title column:


ratings:

TitleSiteRating
Avengers: Endgame Metacritic78%
Avengers: Endgame Rotten Tomatoes94%
Avengers: Endgame IMDB85%
TitanicRotten Tomatoes92%
TitanicIMDB91%

 

I want to sort the movies by average rating from chosen services.

 

I tried to make a measure like AvgRating = AVERAGE(ratings[Rating]), and it computes exactly what I wanted, but you cannot sort a slicer by measure.
I also tried making a calculated column in the movies table: AvgRating = AVERAGE(ratings[Rating]), so I can use the "sort by column" option. However, calculated columns in PBI are only refreshed on data load, so the results do not change when I choose different services.

Is there any option to do this kind of thing, or am I doomed?

 

Thanks in advance!

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

Hi,

Based on your description, I created data to reproduce the scenario. ‘AvgRatings’ is a column. ‘AvgRating’ is a measure.

 

AvgRatings = CALCULATE(AVERAGE(ratings[Rating]),RELATEDTABLE(ratings))

 

AvgRating = AVERAGE(ratings[Rating])

a.png

It is unavailable to sort a slicer by measure. As a workaround, you can use the ‘Hierarchical Filter - xViz’ visual from Marketplace and use ‘AvgRating’ measure as value. And in the ‘Fields’, click the ‘drop down’ button and choose ‘show item with no data’.

b.png

Result:

d1.png

If I misunderstand your thought, please show me your expected output, I am glad to solve the problem for you.

 

Best Regards,

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-alq-msft
Community Support
Community Support

Hi,

Based on your description, I created data to reproduce the scenario. ‘AvgRatings’ is a column. ‘AvgRating’ is a measure.

 

AvgRatings = CALCULATE(AVERAGE(ratings[Rating]),RELATEDTABLE(ratings))

 

AvgRating = AVERAGE(ratings[Rating])

a.png

It is unavailable to sort a slicer by measure. As a workaround, you can use the ‘Hierarchical Filter - xViz’ visual from Marketplace and use ‘AvgRating’ measure as value. And in the ‘Fields’, click the ‘drop down’ button and choose ‘show item with no data’.

b.png

Result:

d1.png

If I misunderstand your thought, please show me your expected output, I am glad to solve the problem for you.

 

Best Regards,

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors