Forum Discussion
Need Help: Conditional Masking in Power BI Table Visual
Hi Power BI Community,
I'm currently working on a project where I have a table visual displaying columns for Account, Name, Amount, and a custom column called SH. In this custom column, I have certain values, let's say 'xy', that I want to replace with '***' for the corresponding Account, Name, and SH columns, but I want to keep the Amount column unaffected.
Here's what I'm looking to achieve:
| Account | Name | Amount | SH |
|---------|------|--------|----|
| 123 | John | $100 | xy |
| 456 | Jane | $150 | ab |
| 789 | Alex | $200 | xy |
Expected Result:
| Account | Name | Amount | SH |
|---------|------|--------|----|
| *** | *** | $100 | *** |
| 456 | Jane | $150 | ab |
| *** | *** | $200 | *** |
Could someone guide me on how to achieve this in Power BI? Any help or suggestions would be greatly appreciated!
Thank you in advance!
- Anonymous2 years ago
Hi Chelly ,
First of all, many thanks to amitchandak for your very quick replies.
Please try below steps:
1. below is my test table
Table:
2. create measure with below dax formula
MEASURE = VAR cur_sh = SELECTEDVALUE ( 'Table'[SH] ) RETURN IF ( CONTAINSSTRING ( cur_sh, "xy" ), "***", cur_sh )Measure 2 = VAR cur_sh = SELECTEDVALUE ( 'Table'[SH] ) RETURN IF ( CONTAINSSTRING ( cur_sh, "xy" ), "***", SELECTEDVALUE ( 'Table'[Account] ) )Measure 3 = VAR cur_sh = SELECTEDVALUE ( 'Table'[SH] ) RETURN IF ( CONTAINSSTRING ( cur_sh, "xy" ), "***", SELECTEDVALUE ( 'Table'[Name] ) )3. add a table visual with measure and field
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- AnonymousNot applicable
Hi Chelly ,
First of all, many thanks to amitchandak for your very quick replies.
Please try below steps:
1. below is my test table
Table:
2. create measure with below dax formula
MEASURE = VAR cur_sh = SELECTEDVALUE ( 'Table'[SH] ) RETURN IF ( CONTAINSSTRING ( cur_sh, "xy" ), "***", cur_sh )Measure 2 = VAR cur_sh = SELECTEDVALUE ( 'Table'[SH] ) RETURN IF ( CONTAINSSTRING ( cur_sh, "xy" ), "***", SELECTEDVALUE ( 'Table'[Account] ) )Measure 3 = VAR cur_sh = SELECTEDVALUE ( 'Table'[SH] ) RETURN IF ( CONTAINSSTRING ( cur_sh, "xy" ), "***", SELECTEDVALUE ( 'Table'[Name] ) )3. add a table visual with measure and field
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.