Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hey Community!
I have those two tables:
I want to get the movie with the highest ROI for each Major Genre and show the Director's name of the film.
The tables are related by column name "Title".
I tried to rank by group (Genre) that will be ordered descending by ROI to get all the 1's, but it didn't work.
Where did I go wrong?
Here's the DAX code:
Rank Genre =
RANKX(ALLEXCEPT(Movie_Details, Movie_Details[Major Genre]),MAXX(RELATEDTABLE(Revenue),Revenue[ROI]),,DESC)
And here's an example of the ranking for the genre "Action" with descending ROI:
Solved! Go to Solution.
DEFINE
MEASURE ROIs[Total ROI] = sum(ROIs[ROI] )
MEASURE Films[Rank by ROI] =
if ( ISINSCOPE(Films[Title] ),
var CurrentGenre = SELECTEDVALUE( Films[Genre] )
var RankWithinGenre =
RANKX(
FILTER(
ALLSELECTED( Films ),
Films[Genre] = CurrentGenre
),
[Total ROI]
)
return
RankWithinGenre
)
DEFINE
MEASURE ROIs[Total ROI] = sum(ROIs[ROI] )
MEASURE Films[Rank by ROI] =
if ( ISINSCOPE(Films[Title] ),
var CurrentGenre = SELECTEDVALUE( Films[Genre] )
var RankWithinGenre =
RANKX(
FILTER(
ALLSELECTED( Films ),
Films[Genre] = CurrentGenre
),
[Total ROI]
)
return
RankWithinGenre
)
Thanks! it works great!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
42 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
43 | |
39 | |
33 | |
18 | |
17 |