Forum Discussion
DAX for RLS?
Option A - One dataset, dynamic RLS with OR logic
If both user groups can see data from either CostCenter or Contract, build dynamic RLS using security tables.
Example setup:
Security_CostCenter with columns [UPN, CostCenterKey]
Security_Contract with columns [UPN, ContractKey]
Create one RLS role that allows access if either condition is true:
VAR u = USERPRINCIPALNAME()
VAR AllowedCC = CALCULATETABLE(VALUES(Security_CostCenter[CostCenterKey]), Security_CostCenter[UPN] = u)
VAR AllowedContract = CALCULATETABLE(VALUES(Security_Contract[ContractKey]), Security_Contract[UPN] = u)
RETURN
CONTAINS(AllowedCC, Security_CostCenter[CostCenterKey], Revenue[CostCenterKey])
||
CONTAINS(AllowedContract, Security_Contract[ContractKey], Revenue[ContractKey])
This lets both reports work from the same model, while access is decided dynamically.
Option B - Two datasets with separate RLS
If the same users must see different data in different reports, create two datasets.
Dataset A uses RLS by CostCenter.
Dataset B uses RLS by Contract.
Each report connects to its own dataset. This is cleaner to maintain when access rules differ completely.
Option C - Embedded reports with selected roles
If your reports are embedded in an app, you can specify the RLS role at runtime. For example, Report 1 runs under “CostCenterRole” and Report 2 under “ContractRole”. This method works only in embedded solutions, not in regular Power BI Service.