Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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.
Solved! Go to Solution.
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.
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.
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.
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.
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!
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.
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 |
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.