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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
saif
Frequent Visitor

Switch the columns being displayed in a table based on signed in user access

Hi,

 

Suppose I have a table named MasterData in my dataset with the following columns:

 

NameUnMaskedEmailID  MaskedEmailID
John Doejohn.doe@abc.com*****@***.com
Mary Janemary.jane@abc.com*****@***.com
Bruce Waynebruce.wayne@abc.com*****@***.com

 

Also I have a table which would store the access level of users ie

 

EmailRole
admin@abc.comAdmin
user1@abc.comViewer
dev1@abc.comMember



Now what I want to achieve is that if the user admin@abc.com logs in into powerbi service, then he should see

NameUnMaskedEmailID 
John Doejohn.doe@abc.com
Mary Janemary.jane@abc.com
Bruce Waynebruce.wayne@abc.com

 

Whereas if user1@abc.com or dev1@abc.com logs in into powerbi service, then they should see

 

NameMaskedEmailID
John Doe*****@***.com
Mary Jane*****@***.com
Bruce Wayne*****@***.com

 

Any help would be greatly appreciated.

 

Thanks!

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi  @saif ,

 

You need to create a dimension table as below:

Table 2 = CROSSJOIN(GENERATESERIES(1,3,1),VALUES('Table'[UnMaskedEmailID ]))

Then create a measure as below:

Measure = SWITCH(
    SELECTEDVALUE('Table 2'[Value]),1,CALCULATE(MAX('Table'[UnMaskedEmailID ]),FILTER(ALL('Table'),'Table'[Name]=MAX('Table'[Name]))),2,"xxx@xxx.com",3,BLANK())

Then using RLS,set the roles as below:

v-kelly-msft_0-1619426177975.pngv-kelly-msft_1-1619426192722.png

v-kelly-msft_2-1619426203406.png

And you will see:

v-kelly-msft_3-1619426411272.pngv-kelly-msft_4-1619426469094.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

 

 

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi  @saif ,

 

You need to create a dimension table as below:

Table 2 = CROSSJOIN(GENERATESERIES(1,3,1),VALUES('Table'[UnMaskedEmailID ]))

Then create a measure as below:

Measure = SWITCH(
    SELECTEDVALUE('Table 2'[Value]),1,CALCULATE(MAX('Table'[UnMaskedEmailID ]),FILTER(ALL('Table'),'Table'[Name]=MAX('Table'[Name]))),2,"xxx@xxx.com",3,BLANK())

Then using RLS,set the roles as below:

v-kelly-msft_0-1619426177975.pngv-kelly-msft_1-1619426192722.png

v-kelly-msft_2-1619426203406.png

And you will see:

v-kelly-msft_3-1619426411272.pngv-kelly-msft_4-1619426469094.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

 

 

Thank you for your detailed explaination. This really helps!🤝

amitchandak
Super User
Super User

@saif , I think perspectives can help

https://data-marc.com/2020/08/18/power-bi-visual-customization-using-perspectives/

https://medium.com/hitachisolutions-braintrust/get-a-new-perspective-on-your-power-bi-dataset-a1c546...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors