Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
We have implemented the Row Level Security (RLS) with Active Directory Groups.we have created Management Cost AD group for users who required access to the Cost related information.
We have a requirement where, Users who are not part of Management cost AD group should not be allowed to see Cost related information(data masking) in Power BI tabular Editor.
Please help us with some suggestions on how to impliment using Tabular Editor.
Thank you...
Solved! Go to Solution.
Hi @prajwala ,
To implement RLS with data masking in Power BI, ensuring that users who are not part of a specific AD group (like Management Cost AD group) see masked or hidden cost-related information, you can achieve this by creating dynamic RLS roles using Tabular Editor and DAX expressions. Here's how you can implement it step by step:
Dynamic Masking Logic:
If the user is not part of the Management Cost AD group, show masked data (e.g., zero, null, or "Restricted"). Otherwise, show the actual cost data.
Example DAX Expression for Cost Columns:
You can write this as a calculated column or modify a measure in Tabular Editor:
MaskedCost =
IF (
ISFILTERED ( 'UserADGroup'[GroupName] ) &&
CONTAINS ( 'UserADGroup', 'UserADGroup'[GroupName], "Management Cost AD" ),
[Cost],
"Restricted"
)
Example DAX Expression for Cost Columns:
Steps:
Assume you have a table or data source with user groups linked to users. This can be imported or queried dynamically.
Table: 'UserADGroup' with columns:
[UserEmail] or [UserName] (matches USERPRINCIPALNAME()).
[GroupName] (contains the group names such as "Management Cost AD").
Join this table to your main fact table where costs are stored.
Mask Data for Unauthorized Users
Now, use the above logic within a measure instead of a column for flexibility. Modify your cost measure:
Masked_Cost_Measure =
VAR UserInGroup =
LOOKUPVALUE ( 'UserADGroup'[GroupName], 'UserADGroup'[UserEmail], USERPRINCIPALNAME() )
RETURN
IF ( UserInGroup = "Management Cost AD", SUM ( 'FactTable'[Cost] ), BLANK () )
Explanation:
LOOKUPVALUE checks if the current user's email belongs to the Management Cost AD group.
If the user is part of the group, the measure shows the actual cost.
If not, it returns BLANK() or any masked value (e.g., "Restricted" or 0).
'UserADGroup'[UserEmail] = USERPRINCIPALNAME()This ensures that users only see their respective group data.
I hope the provided solution works for you
If I have resolved your question, please consider marking my post as a solution. Thank you!
A kudos is always appreciated—it helps acknowledge the effort and keeps the community thriving.
Hi @prajwala
Did the solution grazitti_sapna and johnt75 offered help you solve the problem, if them helps you can consider to accept them as solutions so that more user can refer to, if you have other problems , you can provide some information so that can offer some more suggestion for you,
Best Regards!
Yolo Zhu
Hi @prajwala ,
To implement RLS with data masking in Power BI, ensuring that users who are not part of a specific AD group (like Management Cost AD group) see masked or hidden cost-related information, you can achieve this by creating dynamic RLS roles using Tabular Editor and DAX expressions. Here's how you can implement it step by step:
Dynamic Masking Logic:
If the user is not part of the Management Cost AD group, show masked data (e.g., zero, null, or "Restricted"). Otherwise, show the actual cost data.
Example DAX Expression for Cost Columns:
You can write this as a calculated column or modify a measure in Tabular Editor:
MaskedCost =
IF (
ISFILTERED ( 'UserADGroup'[GroupName] ) &&
CONTAINS ( 'UserADGroup', 'UserADGroup'[GroupName], "Management Cost AD" ),
[Cost],
"Restricted"
)
Example DAX Expression for Cost Columns:
Steps:
Assume you have a table or data source with user groups linked to users. This can be imported or queried dynamically.
Table: 'UserADGroup' with columns:
[UserEmail] or [UserName] (matches USERPRINCIPALNAME()).
[GroupName] (contains the group names such as "Management Cost AD").
Join this table to your main fact table where costs are stored.
Mask Data for Unauthorized Users
Now, use the above logic within a measure instead of a column for flexibility. Modify your cost measure:
Masked_Cost_Measure =
VAR UserInGroup =
LOOKUPVALUE ( 'UserADGroup'[GroupName], 'UserADGroup'[UserEmail], USERPRINCIPALNAME() )
RETURN
IF ( UserInGroup = "Management Cost AD", SUM ( 'FactTable'[Cost] ), BLANK () )
Explanation:
LOOKUPVALUE checks if the current user's email belongs to the Management Cost AD group.
If the user is part of the group, the measure shows the actual cost.
If not, it returns BLANK() or any masked value (e.g., "Restricted" or 0).
'UserADGroup'[UserEmail] = USERPRINCIPALNAME()This ensures that users only see their respective group data.
I hope the provided solution works for you
If I have resolved your question, please consider marking my post as a solution. Thank you!
A kudos is always appreciated—it helps acknowledge the effort and keeps the community thriving.
You can use object level security as well as row level security - https://learn.microsoft.com/en-us/fabric/security/service-admin-object-level-security?tabs=table
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 57 | |
| 34 | |
| 33 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 67 | |
| 65 | |
| 44 | |
| 30 | |
| 28 |