Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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!
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
13 | |
11 | |
10 | |
10 |