Forum Discussion

mmanwaring's avatar
mmanwaring
Resolver I
10 years ago
Solved

RLS - creating a measure to overide RLS

Hi All

 

I have added RLS to a test dashboard.

 

My aim is to create a dashboard and share with a number of users. Each user will have data restriced to their sales only!

 

i have been asked as part of the dashboard that the user viewing the dashboard sees a KPI against the top sales person.

"User sales versus top sales person"

 

I created a calculate measure to clear the filter using ALL but RLS ignored this.

 

Can anyone help with a solution in this regard?

 

many thanks

Mike

  • mmanwaring

    As per the online document Row-level security, the RLS filter the dataset directly. So I don't think your approach would ok.

    In your case, to see a KPI against the top sales person in the condition that each user only has data restriced to their sales only, I think you can use a custom column storing the top sales.

    TotalSalesForEachSaler = CALCULATE(SUM(Listings[sales]),FILTER(Listings,Listings[salerid]=EARLIER(Listings[salerid])))
    
    TopSales = MAXX(Listings,Listings[TotalSalesForEachSaler])

     

    If you have any question, feel free to let me know.

7 Replies

  • Ermin's avatar
    Ermin
    Advocate II

    Hi mmanwaring,

     

    I have a similar issue with my multitenant Power BI dashboard.

     

    Here is the link to my question:

    http://community.powerbi.com/t5/Desktop/Power-BI-Embedded-and-multitenant-support/m-p/97576#M41109

     

    There are also various answers on how to handle this topics. However, it looks like there is no standard solution to these kind of problems. 

    Microsoft would need to catch up here because the whole effect of comparing my KPIs to the other is missing within RLS. 

     

    In case you find a solution for this please keep me in the loop.

    • mmanwaring's avatar
      mmanwaring
      Resolver I

      Hi Ashishrj

      thank you for the link.

      i could not see anything within the video which describes RLS security as part of my powerbi.com dashboard which leads to a solution i am looking for.

      Regards

      Mike

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    mmanwaring

    As per the online document Row-level security, the RLS filter the dataset directly. So I don't think your approach would ok.

    In your case, to see a KPI against the top sales person in the condition that each user only has data restriced to their sales only, I think you can use a custom column storing the top sales.

    TotalSalesForEachSaler = CALCULATE(SUM(Listings[sales]),FILTER(Listings,Listings[salerid]=EARLIER(Listings[salerid])))
    
    TopSales = MAXX(Listings,Listings[TotalSalesForEachSaler])

     

    If you have any question, feel free to let me know.

    • vinaypugalia's avatar
      vinaypugalia
      Resolver I

      Hello Eric,

       

      The solution you have shared will work for sure. But my concern is, what if the user applies filters to the report.

      For e.g. if the user filters the data by Geography, or say Date Range, etc., this is very much possible that the TOP performer for the filtered geography or the selected date range might change but if we calcualte it from backend/precalcualte the rank, it will remain constant.

       

      Hence, please guide how to handle this situation.

       

      Thanks,

      Vinay

  • Anonymous's avatar
    Anonymous
    Not applicable

    this is not solved yet!