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

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.

Reply
Anonymous
Not applicable

Pull a specfic rank from a Rankx measure into a card based off the slicer selection

Hi,

 

I am having a difficult time trying to pull in these specific Ranks based off the slicer the user can choose.

 

I have a slicer that selects the "Dealer Number/Group" and I just want it to pull the # Rank of Net Profit $ Dealer.

 

Thanks for any Help!

 

RankX.png

 

 

Here is my Rankx Function:

 

Rank, NP $ CY =
                       If( isblank( [Net Profit $ Dealer]) , blank() ,
                         RANKX(
                             Filter( ALL(Dealers[Dealer Number/Group]) ,not(isblank([Net Profit $ Dealer]))),
                             [Net Profit $ Dealer], , DESC))

 

I tried something like this too, but it hasnt work in a card slicer:

 

Overall Rank, NP $ =
VAR vSummary =
    SUMMARIZE (
        ALL ( DealerMonthlyFinancials ),
        Dealers[Dealer Number/Group],
        "Sales", [Net Profit $ Dealer]
    )
VAR vRank =
    ADDCOLUMNS ( vSummary, "Rank", RANKX ( vSummary, [Net Profit $ Dealer],, DESC, DENSE ) )
VAR vMax =
    MAXX ( vRank, [Rank, NP $ CY] )
VAR vBrand =
    SELECTEDVALUE ( Dealers[Dealer Number/Group],  Blank() )
VAR vBRank =
    MINX ( FILTER ( vRank, Dealers[Dealer Number/Group] = vBrand ),[Rank, NP $ CY])
RETURN
    vBrand & " is " & vBRank & "/" & vMax

 

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

Hi @Anonymous ,

 

You can try changing the all function to the allselected function.

 

Rank, NP $ CY =
                       If( isblank( [Net Profit $ Dealer]) , blank() ,
                         RANKX(
                             Filter( ALLSELECTED(Dealers[Dealer Number/Group]) ,not(isblank([Net Profit $ Dealer]))),
                             [Net Profit $ Dealer], , DESC))

 

You can refer to the following documents that may be helpful to you:

Ranking Values with Measures - (powerbi.tips)

DYNAMIC RANKX BY SLICER SELECTION IN POWER BI - Ruki's Blog (rukiatu.com)

How to use RANKX in DAX (Part 2 of 3 – Calculated Measures) - RADACAD

Use of RANKX in Power BI measures - SQLBI

 

Best Regards,

Neeko Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-tangjie-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can try changing the all function to the allselected function.

 

Rank, NP $ CY =
                       If( isblank( [Net Profit $ Dealer]) , blank() ,
                         RANKX(
                             Filter( ALLSELECTED(Dealers[Dealer Number/Group]) ,not(isblank([Net Profit $ Dealer]))),
                             [Net Profit $ Dealer], , DESC))

 

You can refer to the following documents that may be helpful to you:

Ranking Values with Measures - (powerbi.tips)

DYNAMIC RANKX BY SLICER SELECTION IN POWER BI - Ruki's Blog (rukiatu.com)

How to use RANKX in DAX (Part 2 of 3 – Calculated Measures) - RADACAD

Use of RANKX in Power BI measures - SQLBI

 

Best Regards,

Neeko Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.