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
Anonymous
Not applicable

data masking but need to show current user details

First of all, this is not about row level security.

 

Say we have sales rep and their sales data

 

SalesRep table:

SalesRepId, SalesRepName, MaskedSalesRepName, SalesRepEmail

1,                'Joe Smith',        'Sales Rep A',     'joesmith@gmail.com'

2,                'John Wick',        'Sales Rep B',     'Johnwick@hotmail.com'

 

Sales table: SalesId, SalesRepId, product, price etc

 

Final output (in table and bar chart)

MaskedSalesRepName, No of sales

Sales Rep A,                   12

Sales Rep B,                    5

 

The requirement here is to mask the Sales Rep Name in the report - which is easy to do. However, there is a problem for this approach. 

If the sales rep A login (as joesmith@gmail.com), he sees a report like this, he would not know which sales no is his own as the name is masked. Ideally he sees

MaskedSalesRepName, No of sales

Joe Smith,                     12

Sales Rep B,                    5

 

So while he see everyone else No of sales without knowing their names, he also sees his own sales number. 

 

Hope this makes sense. 

 

Thanks in advance.

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous ,

refer to this link

https://radacad.com/show-the-information-but-not-the-details-power-bi-data-masking

https://radacad.com/secure-the-sensitive-data-in-power-bi-data-masking-better-with-row-level-security

 

You might need a measure like this

Masked Measure =
if( max(Table[SalesRepEmail]) =USERPRINCIPALNAME() = ,max(Table[SalesRepName]),"Other"))

Masked Measure =
IF( max(Table[SalesRepEmail]) =USERPRINCIPALNAME() = ,max(Table[SalesRepName]),max(Table[MaskedName]))

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous ,

refer to this link

https://radacad.com/show-the-information-but-not-the-details-power-bi-data-masking

https://radacad.com/secure-the-sensitive-data-in-power-bi-data-masking-better-with-row-level-security

 

You might need a measure like this

Masked Measure =
if( max(Table[SalesRepEmail]) =USERPRINCIPALNAME() = ,max(Table[SalesRepName]),"Other"))

Masked Measure =
IF( max(Table[SalesRepEmail]) =USERPRINCIPALNAME() = ,max(Table[SalesRepName]),max(Table[MaskedName]))

Anonymous
Not applicable

thanks for the quick reply. It was very helpful. Actually I have read that link before asking the question. I got stuck by trying to use the new measure as the AXIS - which is not possible. I now realised I can use masked Sales Rep name as the AXIS. In order to know which is the current user, all I need is to the set the visual filter to "current user is not blank" (current user is the new measure created in the link)

Greg_Deckler
Super User
Super User

@Anonymous  - Well, you could potentially user USERPRINCIPALNAME like:

MaskedSalesRepName Measure =
  IF(USERPRINCIPALNAME() = MAX([SalesRepEmail]),MAX([SalesRepName]),MAX([MaskedSalesRepName]))

Might work. 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.