cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mmanwaring Regular Visitor
Regular Visitor

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

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator Eric_Zhang
Moderator

Re: RLS - creating a measure to overide RLS

@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])

Capture.PNGCapture1.PNG

 

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

6 REPLIES 6
ashishrj Senior Member
Senior Member

Re: RLS - creating a measure to overide RLS

Hi @mmanwaring Refer video here for RLS. Hope this helps !

mmanwaring Regular Visitor
Regular Visitor

Re: RLS - creating a measure to overide RLS

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

Moderator Eric_Zhang
Moderator

Re: RLS - creating a measure to overide RLS

@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])

Capture.PNGCapture1.PNG

 

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

mmanwaring Regular Visitor
Regular Visitor

Re: RLS - creating a measure to overide RLS

Thank you Eric

worked a treat.

 

Regards

Mike

vinaypugalia Regular Visitor
Regular Visitor

Re: RLS - creating a measure to overide RLS

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

Highlighted
Ermin Frequent Visitor
Frequent Visitor

Re: RLS - creating a measure to overide RLS

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.