Forum Discussion

testyuiiop's avatar
testyuiiop
Helper I
2 years ago
Solved

Rank based on dynamic slicer selection

Hi All, I have a sales table, and I am ranking my customers based on below dax:     RANKX(         ALLSELECTED(Sales[Cust ID],Sales[Cust Name])         ,[Total Sales]         ,         ,...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi testyuiiop 

     

    lbendlin , thanks for your concern about this case.

     

    I’d like to acknowledge the valuable input provided by the Sahir_Maharaj. His initial idea was instrumental in guiding my approach. However, I noticed that further details were needed to fully understand the issue.
    In my investigation, I took the following steps:

     

    My sample:

     

    I created two new tables for each of the two slicers.

     

     

    There is no relationship between the three tables.

     

    I also created a following formula just to get the measure.

     

    Total Sales = CALCULATE(SUM(Sales[Sales]), ALLEXCEPT(Sales, Sales[Cust Name]))

     

     

    Create a measure as follows

     

    rank = RANKX(ALLSELECTED(Sales), [Total Sales], , ASC, Dense)

     

     

    Result:

     

     

    testyuiiop , if this sample data is structurally different from the one you are using, please do not hesitate to mention it and I will modify it!

     

    Best Regards,
    Yulia Xu

     

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