Forum Discussion
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:
| EmailId | License | VendorId |
| [email protected] | L1 | 1234 |
| [email protected] | L2 | 1235 |
| [email protected] | L1 | 1236 |
| [email protected] | L2 | 1237 |
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!