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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Rankx function on two parameters

Untitled.png

 

 

hello ,
i have use some measure for _Actual Cost & contribution Rank bottom that is cantains rank i need to find only top 5 rank but
i was use option wich is in field that give me only one row,,


_Actual cost sum = SUM(YTD2[Actual Cost])


_Actual Contribution avg = AVERAGE(YTD2[Actual Contribution %])

 

_Actual Cost & contribution Rank bottom = RANKX(
ALLSELECTED( YTD2 ),
[_Actual Contribution avg],,ASC
) + DIVIDE (
RANKX ( ALLSELECTED(YTD2), [_Actual cost sum],,DESC),
( COUNTROWS ( ALL ( YTD2 ) ) + 1 )
)

this is some what i use 

regards 
pooja

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

Hi Poojad1,

 

To achieve your requirement, please use DAX formula below:

 _Actual Cost & contribution Rank bottom =

var temp = RANKX(

ALLSELECTED( YTD2 ),

[_Actual Contribution avg],,ASC

) + DIVIDE (

RANKX ( ALLSELECTED(YTD2), [_Actual cost sum],,DESC),

( COUNTROWS ( ALL ( YTD2 ) ) + 1 )

)

return

IF(temp < 6, temp, BLANK())

 

 1.PNG

You can refer to PBIX here:

https://www.dropbox.com/s/hzt2jwi9tt4pexl/For%20Poojad1.pbix?dl=0

 

Regards,

Jimmy Tao

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

Hi Poojad1,

 

To achieve your requirement, please use DAX formula below:

 _Actual Cost & contribution Rank bottom =

var temp = RANKX(

ALLSELECTED( YTD2 ),

[_Actual Contribution avg],,ASC

) + DIVIDE (

RANKX ( ALLSELECTED(YTD2), [_Actual cost sum],,DESC),

( COUNTROWS ( ALL ( YTD2 ) ) + 1 )

)

return

IF(temp < 6, temp, BLANK())

 

 1.PNG

You can refer to PBIX here:

https://www.dropbox.com/s/hzt2jwi9tt4pexl/For%20Poojad1.pbix?dl=0

 

Regards,

Jimmy Tao

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.