Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

RLS and UserPrincipalName()

Hi folks,

 

I took my first foray into implementing RLS in a report that I published from PBI Desktop to our firm's Power BI Service environment, but it, unsurprisingly, hasn't been working. I've been studying a solution here:

 

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Configure-Row-Level-Security-with-OR-condition/m-p/948434

 

Using the above thread, I setup a test RLS table with a handful of "authorized" users, which I would use as a filter in tandem with userprincipalname() to ensure only they can see this report. I used a variation of this DAX expression as a filter for each table in my report:

 

= CONTAINS('RLS', 'RLS'[Email Address], USERPRINCIPALNAME())

 

User NameEmail Address
User 1user email
User 2user email
User 3user email

 

Unfortunately, it doesn't work. What should this filter being set against left of the "=" sign? If its a column like [Email Address], I get errors stating the column couldn't be found and/or is now allowed in the expression. Also, the aforementioned thread suggested that the RLS I set up doesn't need to be given a relationship to any of the tables in the model, which seems contradictory to other solutions I've read (unless I missed something). Appreciate the help in understanding this better. 

 

Best,

 

pb

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Try this in the Table Filter DAX Expression.

    = [Email Address]= USERPRINCIPALNAME()

     

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies