Forum Discussion

Sri_phani's avatar
Sri_phani
Helper III
2 years ago

Ignore RLS and get the rank

Hi, 

I have Employee-wise RLS on the Active agent's table, but I have a separate table called All metrics that has KPIs (1-1 relationship). Now when I applied RLS the ranks show as 1. This is expected behaviour but while finding a workaround, I got to know by removing the relationship between these tables and using the TREATAS function we can get the rank. 

 

I tried many ways but couldn't find a solution. Here is the measure used for finding team-wise rank for selected employees: 

 

Team rank =
VAR table_ =
ADDCOLUMNS(
  FILTER(
    all('All Metrics'[Employee Name],
       'All Metrics'[Supervisor 1 (Team Manager) ]),
           'All Metrics'[Supervisor 1 (Team Manager)] = MAX('All Metrics'[Supervisor 1 (Team Manager) ])
           ),"attain", 
    [Resolve Attainment]
)
Return
Format(rankx(table_,[Resolve Attainment],,desc,Dense), 0)&"/"&COUNTROWS(table_)

 

 
Expected Result is like - 05/10
 

6 Replies

  • Read about CROSSFILTER(,,NONE) - that allows you to temporarily break relationships.

  • lbendlin How do I incorporate Crossfilters in this measure? 

     

    Team rank =
    VAR table_ =
    ADDCOLUMNS(
      FILTER(
        all('All Metrics'[Employee Name],
           'All Metrics'[Supervisor 1 (Team Manager) ]),
               'All Metrics'[Supervisor 1 (Team Manager)] = MAX('All Metrics'[Supervisor 1 (Team Manager) ])
               ),"attain", 
        [Resolve Attainment]
    )
    Return
    Format(rankx(table_,[Resolve Attainment],,desc,Dense), 0)&"/"&COUNTROWS(table_)

     

  • lbendlin I tried using Calculatetable instead of filter, it is giving blanks as well in the result. Sorry, I am finding it hard to understand how can I put a stop to RLS while using Calculatetable function. 

     

     

     

    • lbendlin's avatar
      lbendlin
      Super User

      There is an alternative - use a shadow table that is disconnected from the data model.