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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
BBIUser
Helper IV
Helper IV

Dynamic text based on masked data in the table

Hello,

 

I need to create a dynamic text based on few masked data which is already in the table.

Sample Data:

BBIUser_0-1710689775446.png

I have created a measure to not to show the data on the bar charts based on the filters created in DAX.
MaskedData = COUNTROWS(FILTER(
'Table1', 'Table1'[Employee Count] <> 0 &&
'Table1'[Masked] <> "Yes"))

When the bar chart doesn't show the data, the text should show 'Data Masked' in a card or anyother visual
and when the employee count>1 and Masked=No, then card visual text should be hidden. 

Can I do this in DAX similar to the above? What is the DAX for this to make it work?

 

Thank you.

 

 

1 ACCEPTED SOLUTION

Update the measure as following...

DisplayMessage = 
VAR EmployeeCountMoreThanOne = CALCULATE(COUNTROWS('Sheet1'), 'Sheet1'[Employee Count] > 1)
VAR IsAnyRowMasked = CALCULATE(MAXX('Sheet1', IF('Sheet1'[Masked] = "Yes", 1, 0)), ALLSELECTED('Sheet1')) = 1
RETURN
    IF(EmployeeCountMoreThanOne > 0 && NOT IsAnyRowMasked, "Data Masked", BLANK())




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
BBIUser
Helper IV
Helper IV

@amustafa Thank you! It works.

@Ashish_Mathur DAX that you gave me doesn't fit the solution. amustafa solution worked correctly. Appreciate your reply!

Ashish_Mathur
Super User
Super User

Hi,

Does this work by any chance?

MaskedData = COALESCE(COUNTROWS(FILTER('Table1', 'Table1'[Employee Count] <> 0 &&'Table1'[Masked] <> "Yes")),"Data Masked")

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amustafa
Solution Sage
Solution Sage

Create a measure as following..

 

DisplayMessage = 
VAR EmployeeCountMoreThanOne = CALCULATE(COUNTROWS('Table1'), 'Table1'[Employee Count] > 1)
VAR IsMasked = CALCULATE(MAX('Table1'[Masked]), ALL('Table1')) = "No"
RETURN
    IF(EmployeeCountMoreThanOne > 0 && IsMasked, BLANK(), "Data Masked")

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@amustafa Appreciate your reply!

The card value is not changing to 'Blank' when the filters are changed to Race in Group Category. None of the values under Race are Masked. So, the card should not show 'Data Masked'. 

I tried attaching the .pbix file for troubleshoot.

https://drive.google.com/file/d/15NSWkqo6bPDhZZPIUwq-V2ZwuEUfXMXm/view?usp=drive_link

 

Update the measure as following...

DisplayMessage = 
VAR EmployeeCountMoreThanOne = CALCULATE(COUNTROWS('Sheet1'), 'Sheet1'[Employee Count] > 1)
VAR IsAnyRowMasked = CALCULATE(MAXX('Sheet1', IF('Sheet1'[Masked] = "Yes", 1, 0)), ALLSELECTED('Sheet1')) = 1
RETURN
    IF(EmployeeCountMoreThanOne > 0 && NOT IsAnyRowMasked, "Data Masked", BLANK())




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors