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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Chelly
Frequent Visitor

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!

1 ACCEPTED SOLUTION
Anonymous
Not 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:

vbinbinyumsft_0-1714359717375.png

 

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

vbinbinyumsft_1-1714359778926.png

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.

View solution in original post

2 REPLIES 2
Anonymous
Not 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:

vbinbinyumsft_0-1714359717375.png

 

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

vbinbinyumsft_1-1714359778926.png

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.

amitchandak
Super User
Super User

@Chelly , Refer these

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

https://www.biinsight.com/power-bi-desktop-query-parameters-part2-dynamic-data-masking-and-query-par...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

Top Kudoed Authors