Forum Discussion

simuruge's avatar
simuruge
Regular Visitor
4 years ago
Solved

Employee Manager Slicer

Hi

 

I have an excel source file like below.

Cost Center IDEmployee NameManager Name
113RamGopal
114GopalNull
115RamGopal
116KumarMadan
117KumarMadan
118MadanGopal

 

I also have another excel file that contains Cost Center ID, Cost Center description, few other dimensions and numeric Amount column.

 

Now, I would like to create a people slicer and let's say I enter a manager name then it should filter all the related cost center details mapped to him and also the cost center associated with the employees reporting to him.

 

Example: If I choose Gopal in the Slicer then the output should bring in four cost center ids, 113, 114, 115 and 118.

 

Can you please guide me how to create a slicer like that?

 

Thanks!!

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi simuruge 

    (1)Create a calculated column to return the same name in two columns .

    Name = SWITCH(TRUE(),'Table'[Employee Name]="Gopal","Gopal",'Table'[Manager Name]="Gopal","Gopal",'Table'[Manager Name])

    (2)Create a relationship between two tables . Then you can through the name to filter other info in other tables .

    (3)Add a table visual and add the column you need in it . And search a text filter in Get more visuals .

    When you enter the content you want in the filter ,you can get the result like this .

    I have attached my pbix file , you can refer to it .

     

    Best Regard

    Community Support Team _ Ailsa Tao

3 Replies

  • bcdobbs's avatar
    bcdobbs
    Icon for Community Champion rankCommunity Champion

    If you import both tables into Power Bi, you can then create a relationship between the two tables based on Cost Centre Id. Looking at the data you've sent it will create a 1 to 1 relationship I think in which case everything will just "work" if you drop things into a visual. If that's not the case send a pbix file with some representive data in and can send a working version back. You can just make a 1 to many relationship bi directional but it's not considered best practice.

  • Hi,

    In the Query Editor right click on the Cost Centre ID column of the first table and then select "Unpivot other columns".  Now that all names will be in a single column, you should be able to create a master list of all names in another table and create a slicer from there.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi simuruge 

    (1)Create a calculated column to return the same name in two columns .

    Name = SWITCH(TRUE(),'Table'[Employee Name]="Gopal","Gopal",'Table'[Manager Name]="Gopal","Gopal",'Table'[Manager Name])

    (2)Create a relationship between two tables . Then you can through the name to filter other info in other tables .

    (3)Add a table visual and add the column you need in it . And search a text filter in Get more visuals .

    When you enter the content you want in the filter ,you can get the result like this .

    I have attached my pbix file , you can refer to it .

     

    Best Regard

    Community Support Team _ Ailsa Tao