Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Identify population based on a slicer

Sample Data Hi there,

 

I am looking to identify a population of workers based on a Manager selection in a slicer. The data includes a field called 'All Managers in Management Chain' and i want to identify all workers that include the selected Manager, featured in the Management Chain field. This will give me both the direct and indirect reports.

 

I think its a formula i need - possibly one of the 'Contains' DAX formula or 'Find Text'. Also found the code below but have been unable to get this to work. The formula will ideally flag each worker that has the selected Manager in the Management Chain field so all reports (direct & indirect) are captured.

 

Hoping you can help.....

 

 

 

 

Path Contains Tenant original = 
VAR _SLICER =
    SELECTEDVALUE ( 'Table2'[Customer Name] )
VAR _TENANT =
    CALCULATETABLE (
        VALUES ( 'Table1'[Parent Tenant] ),
        FILTER ( ALL ( 'Table1' ), 'Table1'[Parent Tenant] = _SLICER )
    )
VAR _RESULT =
    IF (
        MAX ( 'Table1'[Tenant Name] )
            IN _TENANT
                && MAX ( 'Table1'[Parent Tenant] ) = _SLICER,
        1
    )
RETURN
    _RESULT

 

 

 

 

 

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Please try:

    Path Contains Manager = 
    VAR _SLICER =
        SELECTEDVALUE ( 'Table2'[Manager Name] )
    VAR _WORKERS =
        CALCULATETABLE (
            VALUES ( 'Table1'[Worker Name] ),
            FILTER ( ALL ( 'Table1' ), CONTAINS('Table1'[All Managers in Management Chain], _SLICER) )
        )
    VAR _RESULT =
        IF (
            MAX ( 'Table1'[Worker Name] )
                IN _WORKERS,
            1
        )
    RETURN
        _RESULT

    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. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      If there was any way i can add a pbix file i would, but it doesnt give me the option.....please advise if there is a way.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Think i have now managed to add sample data.....

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        That leads to a sign-in page.  Also, show the expected result.