Forum Discussion
Need Help: Implementing Dynamic Masking for PHI Data in Power BI
Hi Everyone,
Background:
- We have 60 report users, out of which 34 need access to PHI (Protected Health Information) data. Our environment includes 150 reports with multiple tabs, totaling approximately 450 instances where PHI is displayed.
- At the database level (SQL Server), we’ve implemented column-level encryption. Only privileged users, defined in an Access Matrix table and with a valid certificate & key, can access decrypted data.
- We are using Power BI's semantic model, pulling data from the SQL data warehouse into the Power BI data model (import mode). This ensures the reports pull data from the model rather than via "Direct Query."
- While column-level encryption works well in SQL, we’ve observed that Power BI doesn’t support dynamic decryption of data based on the logged-in user. To address this, we decided to explore dynamic data masking in Power BI.
- To achieve this, we’ve loaded decrypted data into the Power BI data model alongside the Access Matrix table.
Our Goal:
We want to dynamically show either masked or unmasked data in reports based on the logged-in user.
What We’ve Tried:
We attempted to use DAX with the USERNAME() function to dynamically check access rights against the Access Matrix table and mask data as needed. However, we ran into performance issues when dealing with large datasets and transactional-level details.
Questions:
- Is there a way to dynamically decrypt data in Power BI based on the logged-in user?
- If decryption isn’t feasible, what’s the best approach to implement efficient data masking in Power BI while ensuring performance scalability?
We’d appreciate any guidance, examples, or alternative approaches to solve this issue!
Thank you in advance!
1 Reply
- AnonymousNot applicable
Hi svPBI
Based on your description, you can consider to use dynmaic rls to set the access, you can refer to the following link about it.
Dynamic Row Level Security with Power BI Made Simple - RADACAD
Row-level security (RLS) with Power BI - Microsoft Fabric | Microsoft Learn
and it is better that use the userprincipalname() instead of username() , becauses when you publish the report to service, the both functions will return the useraccount instead of 'domain/user'.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.