Forum Discussion
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:
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.
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())
5 Replies
- amustafaSolution 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")- BBIUserHelper IV
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
- amustafaSolution Sage
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())
- Ashish_MathurSuper User
Hi,
Does this work by any chance?
MaskedData = COALESCE(COUNTROWS(FILTER('Table1', 'Table1'[Employee Count] <> 0 &&'Table1'[Masked] <> "Yes")),"Data Masked") - BBIUserHelper 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!