cancel
Showing results for 
Search instead for 
Did you mean: 
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]))



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

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
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors