Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JWBennett
Regular Visitor

Adding a column or measure formula that tests the RLS role of a viewer

Have Dynamic RLS working fine. Howerver ran into a situation where I would like to add column content based on the RLS role of the current user.  I have two Roles: Admin and Delegate.  How do I add content to a column only if the viewers role is "Admin"? 

3 REPLIES 3
parry2k
Super User
Super User

Not understood your request fully but based on your input, you already implemented RLS and have the way to define who is admin. You can use the same in a measure with if condition.

 

My Measure = IF([User is Admin], "value")



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I guess I was not clear. I don't want to know 'who' is an Admin.  I want to know the Role of the Viewer.  It will have to be a DAX Measure I expect.  If it exists at all.

 

Scenario is This:

  • I have two roles defined: Admin and Business Unit (BU)
  • The Admin role is unrestricted. Admin viewers see all data elements in all reports.
  • The BU role is restricted by email address to a BU Affiliation table. Viewers see only data for their BU. Works just fine
  • I have some instructions, contact info, etc. that is different for a BU viewer than it is for an Admin. So I'd like to have a simple method to test the Role of the current Viewer so I may filter the information accordingly.

Hi @JWBennett

Do you follow this article to set RLS?

As you said, "I don't want to know 'who' is an Admin", to make RLS work well, you need define each role with your rule.

To test a role,

You can go to Power BI Service,

  1. Select the ellipse (…) for a dataset.
  2. Select Security
  3. Select the ellipsis (...) next to the role.
  4. Select Test data as role

You will then see reports that are available for this role

8.png

 

You can test other roles, or combination of roles, by selecting Now viewing as.

You can choose to view data as a specific person, or you can select a combination of available roles to validate they are working.

9.png 

Best Regards

Maggie

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.