Forum Discussion
Need help with DAX expression on RLS
- 1 year ago
Hi JustinDoh1,
Based on my understanding, the Security Cross Filtering error arises due to the Apply security filter in both directions setting. Kindly uncheck this option in the relationship between tblPBIGroup and tblPBISecurity, and set the direction to Single from tblPBIGroup to tblPBISecurity. Then, reapply the DAX expression to tblPBISecurity. This should help resolve the issue.
-
For handling multiple locations, please use the updated DAX expression below:
VAR _User = USERPRINCIPALNAME()VAR _AccessToAll = MAXX(FILTER('tblPBIGroup', 'tblPBIGroup'[User] = _User), 'tblPBIGroup'[AccessToAllLocations])
VAR _UserLocations = FILTER('tblPBIGroup', 'tblPBIGroup'[User] = _User)
RETURN
IF(
_AccessToAll = "Yes",
TRUE(),
'tblPBISecurity'[Group] IN SELECTCOLUMNS(_UserLocations, "Location", 'tblPBIGroup'[Location])
)
This logic allows users to access multiple locations as listed in the tblPBIGroup table.
2.The TRUE() function grants unrestricted access to all rows in tblPBISecurity when AccessToAllLocations is set to Yes. Otherwise, it restricts access based on the specific locations.If you find this response helpful, kindly mark it as the accepted solution and consider giving kudos. This will be beneficial for other community members facing similar queries.
Thank you.
-
Hi JustinDoh1,
Based on my understanding, the Security Cross Filtering error arises due to the Apply security filter in both directions setting. Kindly uncheck this option in the relationship between tblPBIGroup and tblPBISecurity, and set the direction to Single from tblPBIGroup to tblPBISecurity. Then, reapply the DAX expression to tblPBISecurity. This should help resolve the issue.
-
For handling multiple locations, please use the updated DAX expression below:
VAR _User = USERPRINCIPALNAME()VAR _AccessToAll = MAXX(FILTER('tblPBIGroup', 'tblPBIGroup'[User] = _User), 'tblPBIGroup'[AccessToAllLocations])
VAR _UserLocations = FILTER('tblPBIGroup', 'tblPBIGroup'[User] = _User)
RETURN
IF(
_AccessToAll = "Yes",
TRUE(),
'tblPBISecurity'[Group] IN SELECTCOLUMNS(_UserLocations, "Location", 'tblPBIGroup'[Location])
)
This logic allows users to access multiple locations as listed in the tblPBIGroup table.
2.The TRUE() function grants unrestricted access to all rows in tblPBISecurity when AccessToAllLocations is set to Yes. Otherwise, it restricts access based on the specific locations.If you find this response helpful, kindly mark it as the accepted solution and consider giving kudos. This will be beneficial for other community members facing similar queries.
Thank you.
- JustinDoh11 year agoPost Prodigy
v-pnaroju-msft Thank you so much for all your help.