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! Learn more

Reply
Koritala
Helper IV
Helper IV

Can we implement the data masking in power bi desktop

Hi All,

 

I would like to know if I can implement data masking in Power BI Desktop when the actual report query doesn't have a unique column , such as "user id"  or "email id" in my report/visual query. I need to mask the PII data in my power bi report.  we are using the Redshift views as source for reports.

Could you please share the complete DAX expression if anyone has any idea plz.

Thanks,

Koritala.

1 ACCEPTED SOLUTION
rohit1991
Super User
Super User

Hi @Koritala ,

Yes, you can implement basic data masking in Power BI Desktop using DAX, even if your dataset doesn’t have a unique "user id" or "email id" column. However, it’s important to note that this method will mask the data for all users the same way, since you can’t dynamically mask based on user context without user identifiers.

If you simply need to mask (obfuscate) certain columns such as names, phone numbers, or email addresses in your visuals, you can use DAX expressions to create masked versions of those fields. Here’s a simple example for masking a column called [Name] by showing only the first letter and replacing the rest with asterisks:

Masked Name = 
LEFT([Name],1) & REPT("*", LEN([Name])-1)

 

You can create similar DAX columns for other PII data like phone numbers by replacing part of the number with asterisks. For example, to mask all digits except the last 2:

Masked Phone =
REPT("*", LEN([Phone])-2) & RIGHT([Phone],2)

 

Just create these calculated columns in Power BI Desktop and use them in your visuals instead of the original columns.

 

If you need more complex masking or want to apply masking dynamically based on user roles, you’ll need user identifiers and possibly implement Row Level Security (RLS) with DAX. But for static masking like above, DAX expressions will work regardless of the presence of user ID columns.

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

6 REPLIES 6
v-priyankata
Community Support
Community Support

Hi @Koritala 
I hope the information from @rohit1991 @GilbertQ @uzuntasgokberk  helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If any posts answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

rohit1991
Super User
Super User

Hi @Koritala ,

Yes, you can implement basic data masking in Power BI Desktop using DAX, even if your dataset doesn’t have a unique "user id" or "email id" column. However, it’s important to note that this method will mask the data for all users the same way, since you can’t dynamically mask based on user context without user identifiers.

If you simply need to mask (obfuscate) certain columns such as names, phone numbers, or email addresses in your visuals, you can use DAX expressions to create masked versions of those fields. Here’s a simple example for masking a column called [Name] by showing only the first letter and replacing the rest with asterisks:

Masked Name = 
LEFT([Name],1) & REPT("*", LEN([Name])-1)

 

You can create similar DAX columns for other PII data like phone numbers by replacing part of the number with asterisks. For example, to mask all digits except the last 2:

Masked Phone =
REPT("*", LEN([Phone])-2) & RIGHT([Phone],2)

 

Just create these calculated columns in Power BI Desktop and use them in your visuals instead of the original columns.

 

If you need more complex masking or want to apply masking dynamically based on user roles, you’ll need user identifiers and possibly implement Row Level Security (RLS) with DAX. But for static masking like above, DAX expressions will work regardless of the presence of user ID columns.

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!
v-priyankata
Community Support
Community Support

Hi @Koritala 
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If @GilbertQ @uzuntasgokberk response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

v-sgandrathi
Community Support
Community Support

Hi @Koritala,

 

Has your issue been resolved?If the response provided by the community members addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.

If yes, kindly accept the useful reply as a solution and give us Kudos. It would be appreciated.

Thank you for your understanding!

GilbertQ
Super User
Super User

Hi @Koritala 

 

Just please be aware they're trying to mocks the data in power BI doesn't necessarily make it 100 percent secure. Just keep that in mind.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

uzuntasgokberk
Super User
Super User

Hello @Koritala ,

 

This questions has been asked. Therefore, I shared the link you can follow:
https://community.fabric.microsoft.com/t5/Desktop/Dynamic-Data-Masking/td-p/3765549

Kind Regards,
Gökberk Uzuntaş

📌 If this post helps, then please consider Accepting it as a solution and giving Kudos — it helps other members find answers faster!

🔗 Stay Connected:
📘 Medium |
📺 YouTube |
💼 LinkedIn |
📷 Instagram |
🐦 X |
👽 Reddit |
🌐 Website |
🎵 TikTok |

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 Kudoed Authors