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

Dynamic ranking based on slicer selection

Hi All -- Need one help with dynamic ranking based on slicer selection. Link has the PBIX file along with data. What I am trying to see is based on my year / month / quarter selection it should give correct ranking in the table like 1,2,3 ...

 

PBIX Code and Data Source 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

It works fine.  See the highlighted portion in the image

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

11 REPLIES 11
Ashish_Mathur
Super User
Super User

Hi,

It works fine.  See the highlighted portion in the image

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

Solution is great however, I have a quick question related to this if you can please answer?

 

I am making a selection through Slicer/Filters where in the background data I have 42 distinct rows. When I create this rank formula, it assigns rank to all 42 but doesnt change (reduce) if i filter few through selection. Like I am making a selection that results in 8 data points, the column technically assign rank till 8 and not all 42 correct?

 

Please help?

 

Thanks

Thank you.  That is an sold post.  Please describe your question, share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Yes this is an old post. You can find my question here where I am not able to get the solution.. If you can please.

 

https://community.powerbi.com/t5/Desktop/Dynamic-x-axis-numbering-based-on-filtering/m-p/2682275#M93...

 

Thanks much

The reply by Anonymous has been marked as Answer.  Have you tried that solution?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Yes that is not exactly this solution, solution is for the second part to basically make a graph dynamic and show us visual based on selection.

 

If i can rank data rows based on selection, I can then use a concatenate column and then use it in the graph to basically disguise the client names on x axis and use Client 1, Client 2 etc based on selection and rank assigned.

 

Hi,

I do not think that will help either because measures cannot be dragged to the X-axis of a graph.  If you write a calculated column formula, then they will not respond to a change in slicers.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Is it. Ok thanks for your reply.

Anonymous
Not applicable

Thank you. That helped

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
smpa01
Super User
Super User

@Anonymous  please try this and test the output

 

Measure 6 =
RANKX (
    CALCULATETABLE (
        VALUES ( Sale[Sales Person] ),
        FILTER (
            ALLSELECTED ( Sale ),
            Sale[Date].[Year] = SELECTEDVALUE ( Sale[Date].[Year] )
        )
    ),
    CALCULATE (
        DIVIDE ( CALCULATE ( SUM ( Sale[Sales] ) ), CALCULATE ( SUM ( Sale[Target] ) ) )
    ),
    ,
    DESC,
    DENSE
)

Capture.PNGx.PNG

Big thanks to @Zubair_Muhammad 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

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.