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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Koritala
Helper IV
Helper IV

Data Masking In Power BI Table visual

Hi All,

 

I need urgent help to mask the PII data in my Table visual for the personal data-related columns in my power bi report.

 

I have 2 types of users. 

1. PII Users

2. Non-PII Users

 

if the user belongs to PII User type, he should be able see the PII columns data. if non-PII user, personal information columns data should be maskes as XXXXXXX.

I have a user table in my redshift database and having 2 columns. 1. user email id 2. PII User(Y/N).

My question is I can't join my user information table with my report query because there is no unique user column in my report query. 

May I know in this scenario, how to mask my report data?

Would approciate if you can share the required measures DAX code.

Thanks,

Srini

 

 

 

1 ACCEPTED SOLUTION
v-venuppu
Community Support
Community Support

Hi @Koritala ,

Thank you for reaching out to Microsoft Fabric Community.

Thank you @Ritaf1983 @Thejeswar for the prompt response.

I have created PBIX file using sample data for Dynamic masking.Please go through the attached PBIX for your reference, even I have tested by replacing USERPRINCIPALNAME() with the email id existing in my UserAccess table.It worked for me.

It shows real data for users with "Y" in IsPIIUser.

It shows asterisks for users with "N" in IsPIIUser.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

Thank you.

View solution in original post

7 REPLIES 7
v-venuppu
Community Support
Community Support

Hi @Koritala ,

As this thread is already solved, please create a new thread in the forum. We are happy to assist.

Thank you.

v-venuppu
Community Support
Community Support

Hi @Koritala ,

Thank you for reaching out to Microsoft Fabric Community.

Thank you @Ritaf1983 @Thejeswar for the prompt response.

I have created PBIX file using sample data for Dynamic masking.Please go through the attached PBIX for your reference, even I have tested by replacing USERPRINCIPALNAME() with the email id existing in my UserAccess table.It worked for me.

It shows real data for users with "Y" in IsPIIUser.

It shows asterisks for users with "N" in IsPIIUser.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

Thank you.

Hi Venu,

The code which you provided for the data masking in table visual based on user type login is giving some issue.
In my report I have a slicers like employersname and Members slicers along with date range slicer. Members slicer will show the coressponding members for the selected Employersname slicer.
I created measure logic for my required columns as per your code provided. The issue is when I drop the firstname masked cloumn which I created, that is not filtering the visaul data as per the employername and Members slicers. For example for X employer there are 2 Members. But when I place the newly created Firstname masked column, it pulling all the records from the backend.

Can you please suggest how to proceed in this scenario.

Thanks,

Sri.

Hi Venu,

Appreciate your solution. it is working as expected. Thanks for your support.

Ritaf1983
Super User
Super User

Hi @Koritala 

In Power BI, there is no native support for masking column values like "XXXXXX" based on user type. What you can do instead are the following two approaches:

  1. Row-Level Security (RLS) – You can restrict entire rows based on user access. However, this won't allow you to show/hide or mask specific column values based on user identity. Column-level security is not natively supported.
    More information is by the link:
    https://www.youtube.com/watch?v=jphj40tBPD8

  2. Separate Report Versions – You can create two versions of the report: one for PII users and another for non-PII users (where sensitive columns are removed or replaced with placeholders). Then, use audience targeting in the Power BI app to share each version with the appropriate group.
    https://www.youtube.com/watch?v=nchNa44o2D4

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Thejeswar
Super User
Super User

Hi @Koritala ,

You can use the REPT() DAX function to perform Data Masking of a certain column like shown below

 

For example,  I am masking the food supply level column. You can use substring to control the number of characters that you want to mask 

MaskedData = REPT("*", LEN([Food_Supply_Level]))

Thejeswar_0-1749616749270.png

 

Using Substring:

Thejeswar_1-1749616910696.png

 

 

If this helps, Accept this as a Solution and Appreciate with a Kudo!

 

Regards,

Hi, it should be dynamic masking not static 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors