The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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:
Title | Box office | Year |
Avengers: Endgame | $2,797,800,564 | 2019 |
Avatar | $2,789,958,507 | 2009 |
Titanic | $2,187,463,944 | 1997 |
Star Wars: The Force Awakens | $2,068,223,624 | 2015 |
Avengers: Infinity War | $2,048,359,754 | 2018 |
And another table with their ratings, related by the Title column:
ratings:
Title | Site | Rating |
Avengers: Endgame | Metacritic | 78% |
Avengers: Endgame | Rotten Tomatoes | 94% |
Avengers: Endgame | IMDB | 85% |
Titanic | Rotten Tomatoes | 92% |
Titanic | IMDB | 91% |
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!
Solved! Go to Solution.
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])
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’.
Result:
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.
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])
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’.
Result:
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.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
137 | |
106 | |
103 | |
73 | |
59 |
User | Count |
---|---|
266 | |
127 | |
119 | |
100 | |
86 |