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

Enabling Row Level security

how to enable row level security in power bi ?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Peter_R Regular Visitor
Regular Visitor

Re: Enabling Row Level security

It's a rather involved topic - best place would be to review the published documentation https://powerbi.microsoft.com/en-us/documentation/powerbi-admin-rls/ and then make some attempts at implementing it for your purposes.

One hint I can point out if you're looking at securing the current user against a table entry is that the USERNAME() function to obtain the current user returns a different format when using the desktop vs published to the service, which presents a challenge when parsing it to get the name.  Even though RLS only applies to published visuals, it can be helpful to display the name of the user somewhere, even for debugging purposes. I use this measure formula to parse the user name into a First.Last format which works from both the desktop and the service:

CurrentUserName =
/*Parse the result of the USERNAME function call to return an uppercase name in the form first.last, which is how names are stored in the SAP table. Note that the USERNAME function returns a different format when called from the PBI Desktop than when called from the PBI Service */
VAR CurrentUser = USERNAME()
VAR PosnOfUserName_domain = SEARCH("\", CurrentUser, 1, 0)
VAR PosnOfUserName_email = SEARCH("@", CurrentUser, 1, 0)
RETURN UPPER(
IF(PosnOfUserName_domain > 0
, MID(CurrentUser, PosnOfUserName_domain + 1, LEN(CurrentUser) - PosnOfUserName_domain)
, LEFT(CurrentUser, PosnOfUserName_email - 1)
)
)

View solution in original post

1 REPLY 1
Peter_R Regular Visitor
Regular Visitor

Re: Enabling Row Level security

It's a rather involved topic - best place would be to review the published documentation https://powerbi.microsoft.com/en-us/documentation/powerbi-admin-rls/ and then make some attempts at implementing it for your purposes.

One hint I can point out if you're looking at securing the current user against a table entry is that the USERNAME() function to obtain the current user returns a different format when using the desktop vs published to the service, which presents a challenge when parsing it to get the name.  Even though RLS only applies to published visuals, it can be helpful to display the name of the user somewhere, even for debugging purposes. I use this measure formula to parse the user name into a First.Last format which works from both the desktop and the service:

CurrentUserName =
/*Parse the result of the USERNAME function call to return an uppercase name in the form first.last, which is how names are stored in the SAP table. Note that the USERNAME function returns a different format when called from the PBI Desktop than when called from the PBI Service */
VAR CurrentUser = USERNAME()
VAR PosnOfUserName_domain = SEARCH("\", CurrentUser, 1, 0)
VAR PosnOfUserName_email = SEARCH("@", CurrentUser, 1, 0)
RETURN UPPER(
IF(PosnOfUserName_domain > 0
, MID(CurrentUser, PosnOfUserName_domain + 1, LEN(CurrentUser) - PosnOfUserName_domain)
, LEFT(CurrentUser, PosnOfUserName_email - 1)
)
)

View solution in original post

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)