Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Supervisor Role Filtering

Hey there,    I have a report that I want to have two views:  A employee view where the report filters my table based on employee email A supervisor view where the report filters my table based ...
  • v-alq-msft's avatar
    5 years ago

    Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

    Table:

     

    Mode:

     

    You may create a measurea as below.

    Visual Control = 
    var emp = SELECTEDVALUE('Table'[Employee],"")
    var sup = SELECTEDVALUE('Table'[Supervisor],"")
    return
    IF(
        ISFILTERED(Mode[Mode]),
        IF(
            "employee mode" in DISTINCT(Mode[Mode])&&NOT("supervisor mode" in DISTINCT(Mode[Mode])),
            IF(
                emp=USERPRINCIPALNAME(),1,0
            ),
            IF(
                "supervisor mode" in DISTINCT(Mode[Mode])&&NOT("employee mode" in DISTINCT(Mode[Mode])),
                IF(
                    sup=USERPRINCIPALNAME(),
                    1,0
                ),
                IF(
                    "employee mode" in DISTINCT(Mode[Mode])&&"supervisor mode" in DISTINCT(Mode[Mode]),
                    IF(
                        OR(
                            emp=USERPRINCIPALNAME(),
                            sup=USERPRINCIPALNAME()
                        ),
                        1,0
                    )
                )
            )
        )
    )

     

    Then you need to put the measure in the visual level filter and use 'Mode' column from 'Mode' table to filter the result.

     

    Finally you may view as '[email protected]'. Here are the results.

     

    Best Regards

    Allan

     

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