Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Power_Guy
Regular Visitor

Data Masking

Hi All,
Need help on this i have a customer table whenever the user with viewer access is rendering the report he should be able to see the table visual with masked customer _address and mobile as i mentioned in the below image 

Power_Guy_0-1717560759303.png

 


Whenever Admin is logging or opening the report he should able to see the tabe visual with non-masked informations

Power_Guy_0-1717560927675.png

 


Please provide Best solutions and suggestions to achive this

2 ACCEPTED SOLUTIONS
Anand24
Super User
Super User

@Power_Guy ,
One suggestion on the top of my mind apart from RLS and OLS is to create a calculated column using userprincipalname().

 

Masked_Customer_Address = 
IF( USERPRINCIPALNAME() IN {"abc1@xyz.com", "abc2@xyz.com, "abc3@xyz.com"},  "******", [Customer_Address])

 

Con: For any new users, your IN operator will need constant manual appending of Email IDs if address is to be masked.

View solution in original post

@Power_Guy You could have a masked address field and a full address field, OLS could hide the unmasked field from non admin users. 

 

@anand24 has an idea too, though I would flip it around so that the masked address is viewed by default and only users specified as admin see the unmasked.

 

Note page level security and the idea from anand are not actually security, just workarounds. This means you must be careful how you give permissions on the underlying data model / dataset, as users will still have access to the fields / data.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

4 REPLIES 4
Anand24
Super User
Super User

@Power_Guy ,
One suggestion on the top of my mind apart from RLS and OLS is to create a calculated column using userprincipalname().

 

Masked_Customer_Address = 
IF( USERPRINCIPALNAME() IN {"abc1@xyz.com", "abc2@xyz.com, "abc3@xyz.com"},  "******", [Customer_Address])

 

Con: For any new users, your IN operator will need constant manual appending of Email IDs if address is to be masked.

Power_Guy
Regular Visitor

Hi @AllisonKennedy 
Thanks for the suggestion
But i don't think we can use Object level security here , becasue if i use ols here , it will hide entire field but
in my scenario user should understand it is address and because of privacy issue it is masked
so i have created two visuals one ffor admin and one for viewer, so
based on the users access , they can see only the visual which authorized them to view

so i have implemented page level security

Welcoming suggestions 😊

@Power_Guy You could have a masked address field and a full address field, OLS could hide the unmasked field from non admin users. 

 

@anand24 has an idea too, though I would flip it around so that the masked address is viewed by default and only users specified as admin see the unmasked.

 

Note page level security and the idea from anand are not actually security, just workarounds. This means you must be careful how you give permissions on the underlying data model / dataset, as users will still have access to the fields / data.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

AllisonKennedy
Super User
Super User

@Power_Guy  I would recommend that this should probably be done upstream in the data warehouse or somewhere other than Power BI, but if you're wanting to do it in Power BI, you can use RLS (Row Level Security). Have you used RLS before? There is also something called Object Level Security, but I think you still need a 3rd party app to make this work. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.