Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago
Solved

rankx by group

I am using the below formula to rank sales results.  I would like to group the ranking by a column of Profit Center's.  What can I add to the below formula so that the ranking column adds a ranking based on the profit center number?

 

Rank = RANKX('Sold-To Database','Sold-To Database'[Total Sales],,DESC,Dense)

 

 

Profit Center   Total Sales

600005            50,000

600005            15,124

600015            16,399

600116              9,131

600015              7,653

  • Anonymous's avatar
    Anonymous
    10 years ago

    Total Sales is a calculated field. 

  • Anonymous's avatar
    Anonymous
    10 years ago

    Good news...your feedback works!  I had to make a small adjustment in my formula and it worked perfect.  Thanks for all your help!

9 Replies

  • Vvelarde's avatar
    Vvelarde
    Icon for Community Champion rankCommunity Champion

    hi Anonymous

     

    Ranking = RANKX(FILTER('Sold-To-Database';'Sold-To-Database'[Profit Center]=EARLIER('Sold-To-Database'[Profit Center]));'Sold-To-Database'[Total Sales];;DESC;Dense)

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Victor,

       

      Thanks for your feedback.  Based on your suggestion I entered the following formula and received the below error.

       

      Thoughts?

       

      Tim

       

      Ranking = RANKX(FILTER('Sold-To Database','Sold-To Database'[Profit Center]=EARLIER('Sold-To Database'[Profit Center])),'Sold-To Database'Sold-To Database'[Total Sales],DESC,Dense)

       

      • Vvelarde's avatar
        Vvelarde
        Icon for Community Champion rankCommunity Champion

        Anonymous

         

        Work with a Calculated Column.

         

        Regards