Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Fixed versus Dynamic Rank with RankX

I have a basic matrix table with Product Name, Profit and two rank columns (1 fixed, 1 dynamic) that are calculated with the following measures:

 

(1) Product Profit Rank = RANKX(ALLSELECTED(Orders[Product Name]),CALCULATE(SUM(Orders[Profit])))

**This measure is dynamic, so it adjusts to the filters I have added. 

 

(2) Product Profit Fixed Rank = RANKX(ALL(Orders[Product Name]),CALCULATE(SUM(Orders[Profit])))

** I used the ALL function - rather than ALLSELECTED like in (1) - becuase I want it to be fixed. So as I change the filter, or click on another visualization, I want the dyanmic formula to readjust the #1 rank, but I want the rankings for the second measure to stay fixed. So there may be a region where product X is #1 rank, but the fixed rank compared to the entire dataset is #10. Why is my second formula (2) not fixed as filter context changes? it keeps dynamically updating like (1).

 

Thanks,

 

Frazer

  • Anonymous's avatar
    Anonymous
    6 years ago
    // This is a global rank that
    // does not respond to
    // any filters.
    
    [Product Profit Fixed Rank] = 
        RANKX(
            ALL( Orders[Product Name] )
            CALCULATE(
                SUM( Orders[Profit] ),
                ALLEXCEPT(
                    Orders,
                    Orders[Product Name]
                )
            )
        )

7 Replies