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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
SarikaKumari18
Helper III
Helper III

How to dynamically show column actual values and do not show or blank based on specific condition

Hello All,
We have requirement to anonymize data(field values) for some of the users and it should work dynamically.
I have Employee table with employee details and one new field has been introduced called "Anonymized" with values Yes and No.
Currently, RLS is applied on employee table (employee name=userprinciplename()).

There are two table charts in Power BI which uses direct columns(name,email,phone) from different DIM table(Customer details). The requirement is if user belong to anonymized category(Yes) then all the field should show as "Anonyized" else show actual values.

Request you all to please guide or share me the related link to achieve such requirement.
Thanks in advance.

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

Hi @SarikaKumari18 ,

 

Has your problem been solved?

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
v-lionel-msft
Community Support
Community Support

Hi @SarikaKumari18 ,

 

Has your problem been solved?

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-lionel-msft
Community Support
Community Support

Hi @SarikaKumari18 ,

 

Is this what you want?

v-lionel-msft_0-1607049314639.png

v-lionel-msft_1-1607049599046.png

 

Step1, Set RLS.

Step2, Set the data with [Anonymized data]="YES" to anonymous.

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hello @v-lionel-msft , could you please elaborate the step 2 in your solution. It might help if you can share the RLS logic .

Hi @v-lionel-msft , 
Thanks for looking into this. we have written below measure to meet the requirement.

Measure : IF(CONTAINS(Employee,Employee[ibm_name],USERPRINCIPALNAME(),Employee[Anonymized data],"Yes"),"Anonymized",MAX('Contact Methods'[fullname]))
We haven't disturbed RLS which is Employee[ibm_name]=USERPRINCIPALNAME()
We are still in process of testing with mutliple user and various scenario.

Thanks & Regards,
Sarika
SarikaKumari18
Helper III
Helper III

@amitchandak 
Hi Amit, I am writing the below measure 

CustomerName = IF(SELECTEDVALUE(Employee[name])=USERPRINCIPALNAME() && SELECTEDVALUE(Employee[Anonymized data])="Yes","Anonymized",MAX('Contact Methods'[Customername]))

This measure works fine when we have two slicer name and Anonymized data but in my scenario it should work dynamically without adding any slicer . Please let me know the solution or any alternative approach.

My goal is to hide the information like customer name,email and phone details for few users. Thanks in advance! Need your help and guidance please
amitchandak
Super User
Super User

@SarikaKumari18 ,

You can try like this ?

sumx(values(Table[employee]) , if(max(Table[Anonyized]) ="Yes", [measure1], [measure2]))

Thanks for a quick response ,
I have tried the above DAX and it throws me an error : "the function sumx cannot work with values of type string"

Measure = SUMX(VALUES(Employee),IF(MAX(Employee[Anonymized data]) ="Yes","Anonymized", MAX('Contact'[fullname])))
Please let me know if I am doing something wrong

@amitchandak Could you please help me to resolve this and also, the solution should work dynmically based on user log in. 
It would be great help and really appreciate this.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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