Forum Discussion

bprokop's avatar
bprokop
Frequent Visitor
4 years ago
Solved

RANK By Multiple Criteria

I am trying to calculate a National Rank and State Rank using the sample data set below.  National Rank would rank Revenue by Client and Product.  State Rank would rank Revenue by Client and Product ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi bprokop 

    I created a sample with the data you provided .

    Create 4 measures separately and rank them according to different categories.

    National high-low = RANKX(FILTER(ALL('Table'),'Table'[Product]=MAX('Table'[Product])),CALCULATE(MAX('Table'[Revenue])),,DESC,Dense)
    National low-high = RANKX(FILTER(ALL('Table'),'Table'[Product]=MAX('Table'[Product])),CALCULATE(MAX('Table'[Revenue])),,ASC,Dense)
    State high-low = RANKX(FILTER(ALL('Table'),'Table'[Product]=MAX('Table'[Product]) && 'Table'[State]=MAX('Table'[State])),CALCULATE(MAX('Table'[Revenue])),,DESC,Dense)
    State low-high = RANKX(FILTER(ALL('Table'),'Table'[Product]=MAX('Table'[Product]) && 'Table'[State]=MAX('Table'[State])),CALCULATE(MAX('Table'[Revenue])),,ASC,Dense)

    The final result is as shown :

    I have attached my pbix file , you can refer to it .

     

    Best Regard

    Community Support Team _ Ailsa Tao

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