March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi all!
I have succesfully implemented row level security using the guide:
https://www.youtube.com/watch?v=Sge_g9hTXWE&feature=emb_logo&ab_channel=PragmaticWorks
Now the only issue is that I can have multiple users (userID's) with the same email adress and my DAX Filter on the table I have implemented RLS on expects a singel UserID. How can I change this DAX Formula in a way that multiple USerID's can be the input of the filter.
DAX Formule on my CustomerStructure table:
[ID] IN SELECTCOLUMNS(
FILTER(
Security_User_CustomerStructure,
Security_User_CustomerStructure[PersonID] = LOOKUPVALUE(Security_Users[PersonID], Security_Users[Email], USERNAME() )
),
"ID", [CustomerStructureID]
)
Printscreens:
Solved! Go to Solution.
Hi @planbitionbi ,
Please refer to the following measure:
[ID]
IN SELECTCOLUMNS (
FILTER (
Security_User_CustomerStructure,
Security_User_CustomerStructure[PersonID]
IN CALCULATETABLE (
VALUES ( Security_Users[PersonID] ),
FILTER ( Security_Users, Security_Users[Email] = USERPRINCIPALNAME () )
)
),
"ID", [CustomerStructureID]
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi!
Thanks a lot for your feedback. Unfortunately it's throwing an error like below. Can you see why it's wrong? Something with the IN clause:
Hi @planbitionbi ,
Please refer to the following measure:
[ID]
IN SELECTCOLUMNS (
FILTER (
Security_User_CustomerStructure,
Security_User_CustomerStructure[PersonID]
IN CALCULATETABLE (
VALUES ( Security_Users[PersonID] ),
FILTER ( Security_Users, Security_Users[Email] = USERPRINCIPALNAME () )
)
),
"ID", [CustomerStructureID]
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi @planbitionbi ,
I suggest you use USERPRINCIPALNAME ( ) instead of USERNAME() and you can change the dax to :
[ID] IN SELECTCOLUMNS(
FILTER(
Security_User_CustomerStructure,
Security_User_CustomerStructure[PersonID] IN CALCULATETABLE(VALUES(Security_Users[PersonID]),FILTER(Security_Users,Security_Users[Email] = USERPRINCIPALNAME())),
"ID", [CustomerStructureID]
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |