Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
1 year ago

Boss/employee segmenter

Good morning, I have the following problem. I have a table with user code, name and boss code. I want to generate a segmenter that allows me to select a name and bring me the data of that user and all their employees.

9 Replies

  • The table would look like this and is connected to other tables using user code.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Syndicate_Admin ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create a table.

    Slicer_name = VALUES('Table'[Nombre])

    (3) We can create a measure. 

    Flag = 
    var _slicer=SELECTEDVALUE('Slicer_name'[Nombre])
    var _boss_code=CALCULATE(SUM('Table'[Codigo Jefe]),FILTER(ALL('Table'),[Nombre]=_slicer))
    RETURN IF(MAX('Table'[Codigo Jefe])=_boss_code,1,0)

    (4) Place [Flag=1] on the visual 1 and visual 2 object's filter and then the result is as follows.

    By selecting the user name in the slicer, visual object 1 will show the boss code for that user and visual object 2 will show all users under that user's boss.

     

     

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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

    • Syndicate_Admin's avatar
      Syndicate_Admin
      Administrator

      Hello good afternoon, what I want you to do is that if you select a user bring all the subordinates and the subordinates of their subordinates, until you reach the person without subordinates

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Hi,

        The PARCHCONTAINS() function should work.  For more specific help, share some data to work with and show the expected result.  Share data in a format that can be pasted in an MS Excel file.

  • It would be so, the first table is the table of facts. It contains the event number, the code of the person who classifies it, classification status, the research number (which coincides with the event number), the code of the person who investigates it, the status of the research, the action code (several actions can be derived from an investigation), the code of the person who must perform it and the status of the action. A person may have to classify, investigate or perform an action. The second table has the codes of each user, the name and the code of their boss. In the example case it is a linear chain: So-and-so is the boss of So-and-so and So-and-so is the boss of Pepito. What I want to achieve is a visual with events and research (since they have the same code) and a visual one with the actions. And put a person in the slicer. So if I put So-and-so I should see all the data of the tasks. If I put Menganito I should see the data of Menganito and Pepito's tasks. If I put Jiminy to see Jiminy's data alone because he has no subordinates.

  • And for an event to go under investigation, it must first be classified. And in order to generate the actions, it must first be investigated.