Forum Discussion

BBIUser's avatar
BBIUser
Helper IV
2 years ago
Solved

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

  • amustafa's avatar
    amustafa
    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")

     

     

      • amustafa's avatar
        amustafa
        Solution 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())
  • Hi,

    Does this work by any chance?

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