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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
cdavisUser
Regular Visitor

DAX command to consider multiple =USERPRINCIPALNAME values in same column

We have a single table that we're using currently to set the RLS / DAX statement against. It is working great.

Email = UserPrincipalName()   , very straightforward.

 

Use case now is allowing multiple users to see the same data. I've read through many of the existing workarounds for this. Is there a way to use Contains or another command that would leave our current schema in tact? Ideally would like to have multiple user names in the same field separated by comma or other delimiter.

 

Thanks for any insight.

 

 

3 REPLIES 3
nandukrishnavs
Super User
Super User

@cdavisUser 

 

Assuming that your data is similar to below. 

 

Store Email
Store1 john@abc.com;tom@abc.com
Store2 mat@abc.com
Store3 neel@abc.com
Store4 richard@abc.com;jack@abc.com

 

Then you could try below DAX in the RLS window.

 

VAR __email = USERPRINCIPALNAME()
VAR __condition =
    IF ( CONTAINSSTRING ( 'Table'[Email], __email ), TRUE (), FALSE () )
RETURN
    __condition

 

 
 

 


Regards,
Nandu Krishna

lbendlin
Super User
Super User

Your single table is the right approach. But it doesn't mean each of your users has to appear only once in it. 😀

amitchandak
Super User
Super User

@cdavisUser ,

Not very clear on the need. See RLS groups can help

https://www.youtube.com/watch?v=oxYQ2GGefrs

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Top Kudoed Authors