Forum Discussion

flyinggnugget's avatar
flyinggnugget
Frequent Visitor
1 year ago
Solved

Dynamic Masking of Column Values

Hi all, was wondering if anyone might be able to help with the problem that I might be facing with trying to perform some kind of dynamic masking of names. Suppose I have a list of student names and ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi flyinggnugget ,

    Please try this way:
    Here is my sample data:


    Use this DAX to create a calculated table for slicer2:

    Slicer2 = VALUES('Table'[Name])


    There is no relationship between three tables:


    Use this DAX to create a measure:

    DisplayName = 
    IF (
        SELECTEDVALUE(Slicer1[Slicer1]) = "Masked",
        IF (
            MAX('Table'[Name]) = SELECTEDVALUE('Slicer2'[Name]),
            MAX('Table'[Name]),
            "Student " & RANKX(FILTER(ALL('Table'), 'Table'[Name] <> SELECTEDVALUE(Slicer2[Name])), 'Table'[Score], SUM('Table'[Score]), DESC, Dense)
        ),
        MAX('Table'[Name])
    )

    And put the DisplayName and other fields into the table visual:

    Then use this DAX to create another measure for filter:

    Filter = 
    IF(
        SELECTEDVALUE(Slicer1[Slicer1]) = "Unmasked",
        IF(
            MAX('Table'[Name]) IN  VALUES(Slicer2[Name]),
            1,
            0
        ),
        1
    )

    Set it up as shown in the following figure:


    Final output:

    Best Regards,
    Dino Tao
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.