Forum Discussion

flyzone's avatar
flyzone
Frequent Visitor
2 years ago

RLS DAX Modeling Help

Hello,

 

I am curious for assistance with what the correct function would be to resolve the following DAX statement to configure RLS:

 

The goal is to have a primary & secondary users (ie Salesforce Account Household Import) both have access to the same RLS-enforced data. An example outcome would be Primary Household User associated data (Enforced by Email address field connected to User Prinicpal Name) is accessible by the secondary household user (via accountID).

 

[Email Address]=
VAR CurrentUserEmail = UserPrincipalName()
VAR CurrentUserAccount = SELECTEDVALUE('Custom Table'[Custom Table_Contact__c])

RETURN
IF(
CONTAINSROW(
FILTER(
ALL('Contact'),
'Contact'[AccountId] = CurrentUserAccount
),
'Contact'[workemail__c] = CurrentUserEmail
),
CurrentUserEmail,
BLANK()
)

3 Replies

    • flyzone's avatar
      flyzone
      Frequent Visitor

      I am looking more for the appropiate syntax or function surrounding the CONTAINSROW line. I want to filter the data by connecting the current user email to the respective work email field which concurrently will match the current user account to all work emails within the specfic user accountid. Essentially two users share an accountid which both need RLS access to the same dataset.

  • flyzone Maybe containsrows is not the right approach, and that's why I asked if you share sample data it will help to provide the appropriate solution.