Forum Discussion

wilson_smyth's avatar
wilson_smyth
Post Patron
9 years ago
Solved

display Rank on a Card visualization

I have a measure that gives the rank of a store, based on its sales against other stores. I want to just display two pieces of info, the currently selected stores rank & the total number of stores. ...
  • MFelix's avatar
    9 years ago

    Hi wilson_smyth,

     

    I don't know how you are calculating your ranking but I ussually use one specific column to rank the values that I need to filter/slice them and them I can use it to have my ranking.

     

    I have created a simple table with Store and Sales then added two measures:

     

    NORMAL_RANK = RANKX(
    		ALLSELECTED(Sales[Store]);
    		CALCULATE(
    			SUM(Sales[Sales])
    			 )
    		    )

    This first measure interacts with the slicers/filter I introduce in the report so it's dinamic and my rank will be influenced by taking out stores from my visual or adding them

     

     

    OVERALL_RANK = RANKX(
    		ALL(Sales[Store]);
    		CALCULATE(
    			SUM(Sales[Sales])
    			 )
    		    )

    In this measure using the ALL function no matter how I have my data sliced it will give me the complete ranking of the store so you can use it in your cards see print below. However using this one if you select more than one value in your slicer in your cards it will give you the first value so be aware of that limitation.

     

     


     

    Regards,

    MFelix

  • wilson_smyth's avatar
    wilson_smyth
    9 years ago

    Apologies, should have responded sooner. 
    Yes, I found  a solution, its pretty much what MFelix suggested.


    I was trying to use one calcuation to do two things:

    - show the rankof all stores

    - show just the rank of the selected score on a card.

     

    The problem was that if i got a calculation to show the list rank, it always displayed a value of 1 when placed on a card, and if i got the correct calculation to show the rank on a card, it wouldnt show the ranked list. so 2 calculations were created.

     

     

    Store Ranking Table = RANKX(ALL('Table'[Store]), CALCULATE([Score]),,0,Dense)

    Individual Store Rank = RANKX(ALL('Table'[Store]), CALCULATE([Score], ALLSELECTED('Table'[Store])),,0,Dense)