Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Employee Manager - Calculated Column

Dear All,

Looking for your help in the following scenario, either in the calculated column or in the query form M.

I have the details like Ename, Role & Mname.

This is a basic query in SQL, that is, a manager can be an employee, but all employees cannot be managers. I need to find the list of employees under each manager.
So I need to derive a new column in PowerBI that could tell if the title is manager or not.

Also, I can enforce row level security for each manager so that they can see only the employee below them.

 

 

 

Cheers
Abhi

  • Hi, Anonymous 

     

    It’s my pleasure to answer for you.

    According to your description, I think create a calculate column to judge the title is manager or not.

    Like this:

    Title3 =
    IF (
        MAXX (
            FILTER ( ALL ( Table2 ), Table2[Ename] = EARLIER ( Table2[Mname] ) ),
            Table2[Role]
        ) = "Manager",
        "SM"
    )

    Or a measure:

    title =
    IF (
        MAXX (
            FILTER ( ALL ( Table2 ), Table2[Ename] = SELECTEDVALUE ( Table2[Mname] ) ),
            Table2[Role]
        ) = "Manager",
        "SM"
    )

     

    If you have other questions, please feel free to ask me.

     

    Best Regards

    Janey Guo

     

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

4 Replies