Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi all, was wondering if anyone might be able to help with the problem that I might be facing with trying to perform some kind of dynamic masking of names. Suppose I have a list of student names and their scores as such:
Name | Score | School |
Jason | 98 | A |
Mary | 41 | A |
Andy | 67 | A |
Sally | 93 | B |
Eugene | 54 | B |
I then want to have a slicer to be able to select whether I want to mask the names or not. This slicer will have the options "Masked" and "Unmasked". If "Unmasked" is selected, my chart will show all the names as it is and their respective scores. However, if "Masked" is selected, there will be another slicer to select a name that I want to show. For example, I have already selected "Masked" in the first slicer, and in the second slicer, I selected "Andy", then in the visual, Andy's name will show as Andy, but the rest of the students will show as "Student 1", "Student 2" , etc.
I am trying to perform this masking in a dynamic way as I am trying to prevent users from figuring out who the students might be. Suppose I have selected "Masked" and "Jason", and in my visual I have the values sorted in descending order, then the first bar will show "Jason" with a score of 98. In the second bar it should show "Student 1" in place of Sally with a score of 93, third bar "Student 2" in place of Andy with a score of 67.
If anyone has any idea on how to approach this, your help will be greatly appreciated. Feel free to create tables or add additional columns if needed. Thanks!
Solved! Go to Solution.
Hi @flyinggnugget ,
Please try this way:
Here is my sample data:
Use this DAX to create a calculated table for slicer2:
Slicer2 = VALUES('Table'[Name])
There is no relationship between three tables:
Use this DAX to create a measure:
DisplayName =
IF (
SELECTEDVALUE(Slicer1[Slicer1]) = "Masked",
IF (
MAX('Table'[Name]) = SELECTEDVALUE('Slicer2'[Name]),
MAX('Table'[Name]),
"Student " & RANKX(FILTER(ALL('Table'), 'Table'[Name] <> SELECTEDVALUE(Slicer2[Name])), 'Table'[Score], SUM('Table'[Score]), DESC, Dense)
),
MAX('Table'[Name])
)
And put the DisplayName and other fields into the table visual:
Then use this DAX to create another measure for filter:
Filter =
IF(
SELECTEDVALUE(Slicer1[Slicer1]) = "Unmasked",
IF(
MAX('Table'[Name]) IN VALUES(Slicer2[Name]),
1,
0
),
1
)
Set it up as shown in the following figure:
Final output:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @flyinggnugget ,
Please try this way:
Here is my sample data:
Use this DAX to create a calculated table for slicer2:
Slicer2 = VALUES('Table'[Name])
There is no relationship between three tables:
Use this DAX to create a measure:
DisplayName =
IF (
SELECTEDVALUE(Slicer1[Slicer1]) = "Masked",
IF (
MAX('Table'[Name]) = SELECTEDVALUE('Slicer2'[Name]),
MAX('Table'[Name]),
"Student " & RANKX(FILTER(ALL('Table'), 'Table'[Name] <> SELECTEDVALUE(Slicer2[Name])), 'Table'[Score], SUM('Table'[Score]), DESC, Dense)
),
MAX('Table'[Name])
)
And put the DisplayName and other fields into the table visual:
Then use this DAX to create another measure for filter:
Filter =
IF(
SELECTEDVALUE(Slicer1[Slicer1]) = "Unmasked",
IF(
MAX('Table'[Name]) IN VALUES(Slicer2[Name]),
1,
0
),
1
)
Set it up as shown in the following figure:
Final output:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
A slicer is the wrong approach. You need to use separate reports, or hide the "unmasked" copy of the table.