Forum Discussion

vantech828's avatar
vantech828
New Member
3 years ago

RLS with IF condition

Hello,
I have a data model (tables are a mix of directquery & import) saved as a standalone PBIX file that I would like to set up RLS for.  The goal is that reports I create will be connected to this data model via live connection.

 

I have the DAX expression to filter VendorId for a couple dim tables (imported) and it works fine. I am having trouble with the 2nd requirement, which is to only filter for the VendorID in a fact table (FactRevenue - connected via DirectQuery) in the data model IF 'DimVendor_RowLevelSecurity'[License] = L1, ELSE show all records.

 

DimVendor_RowLevelSecurity Table:

EmailIdLicenseVendorId
[email protected]L11234
[email protected]L21235
[email protected]L11236
[email protected]L21237

 

This expression is saved in the 'Manage Roles' popup for DimVendor table:
And (
'DimVendor'[VendorId] IN
SELECTCOLUMNS(
FILTER(
'DimVendor_RowLevelSecurity',
[EmailId]=USERPRINCIPALNAME()
),
[VendorID]
),
1=1
)

 

Appreciate any guidance. Thanks!

No RepliesBe the first to reply