Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi All,
I am calculating the First Highest ROMI, Second Highest ROMI, 3rd Highest ROMI etc.
I have created the below DAX measures for the same.
Solved! Go to Solution.
Hi @Anonymous ,
I create a simple example. Please check if it is what you want.
Rank 1 Campaign_Name on ROMI =
VAR TOPTable =
TOPN (
1,
SUMMARIZE (
VALUES ( Spend[campaign] ),
Spend[campaign],
"ROM", [Revenue/Spend (ROMI)]
),
[Revenue/Spend (ROMI)], DESC
)
RETURN
CALCULATE (
MAX ( Spend[campaign] ),
FILTER ( TOPTable, [Revenue/Spend (ROMI)] = MINX ( TOPTable, [ROM] ) )
)Rank 2 Campaign_Name on ROMI =
VAR TOPTable =
TOPN (
2,
SUMMARIZE (
VALUES ( Spend[campaign] ),
Spend[campaign],
"ROM", [Revenue/Spend (ROMI)]
),
[Revenue/Spend (ROMI)], DESC
)
RETURN
CALCULATE (
MAX ( Spend[campaign] ),
FILTER ( TOPTable, [Revenue/Spend (ROMI)] = MINX ( TOPTable, [ROM] ) )
)
If the rank is repeated, only one campaign_name will be displayed.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
I create a simple example. Please check if it is what you want.
Rank 1 Campaign_Name on ROMI =
VAR TOPTable =
TOPN (
1,
SUMMARIZE (
VALUES ( Spend[campaign] ),
Spend[campaign],
"ROM", [Revenue/Spend (ROMI)]
),
[Revenue/Spend (ROMI)], DESC
)
RETURN
CALCULATE (
MAX ( Spend[campaign] ),
FILTER ( TOPTable, [Revenue/Spend (ROMI)] = MINX ( TOPTable, [ROM] ) )
)Rank 2 Campaign_Name on ROMI =
VAR TOPTable =
TOPN (
2,
SUMMARIZE (
VALUES ( Spend[campaign] ),
Spend[campaign],
"ROM", [Revenue/Spend (ROMI)]
),
[Revenue/Spend (ROMI)], DESC
)
RETURN
CALCULATE (
MAX ( Spend[campaign] ),
FILTER ( TOPTable, [Revenue/Spend (ROMI)] = MINX ( TOPTable, [ROM] ) )
)
If the rank is repeated, only one campaign_name will be displayed.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Icey Thanks Icey!! That's a great help.
The above calculation is working fine to calculate ROMI(Revenue/Spend) and Campaign_Name based on Rank.
I am trying to achieve the same nth Rank for "VS Last Quarter" . Tried below 2 DAX for the same. None of them is giving the correct result. Getting same values for all the ranks.
Rank 2 VSLastQTR =
MINX (
TOPN ( 2, VALUES ( Spend[campaign_id] ), [Revenue/Spend (ROMI)], DESC ),
[VS Last Quarter]
)
VS Last Quarter = [Current QTD Revenue/Spend]-[Last QTD Revenue/Spend]
Hi @Anonymous ,
What about this?
Rank 2 VSLastQTR =
MINX (
TOPN ( 2, VALUES ( Spend[campaign_id] ), [VS Last Quarter], DESC ),
[VS Last Quarter]
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous you can use MAX function for Campign Name instead of value, change it in all measures
Rank 1 ROMI=
VAR RankingRate=VALUES(Spend[campaign_id])
return
CALCULATE(MAX( Spend[campaign_name]),
TOPN(1,VALUES(Spend[campaign_id]),[Revenue/Spend (ROMI)]),RankingRate)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k Hi Parry,
Yes I am doing the same . It is working fine for First Rank. But for 2nd Rand onwards it is not showing me the correct Campaign Name.
I have to find the Campaign name till 6th Rank ROMI.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.