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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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!🤝

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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