Forum Discussion

LP280388's avatar
LP280388
Icon for Resolver II rankResolver II
4 years ago

How to get selected value from a Hierarchy Slicer

Hi Team,

 

Need a help in fetching the selected value from a hierarchy slicer. For example : I have the data as below.

 

I need to show the max hierarchy selected.  In the second image below, abc2 is selected and thats the max level selected which need to be shown in a single card visual. 

 

In the third image below : abc5 is selected and thats the max level selected by the user which needs to be shown.  

 

Kindly help me how this can be achieved.

 

 

 

 

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Create index column in your table for Employees.

     

    then use the below dax to get desired output.

     

    Selected Value = 
    VAR MAXIndex = CALCULATE(MAX(Sampl[Index]),ALLSELECTED(Sampl))
    RETURN
    IF(MAX(Sampl[Index]) = MAXIndex, MAX(Sampl[Emp]))

     

    Do accept the solution if it fulfills your need.

     

    Thanks,

    Mohan V.

    • LP280388's avatar
      LP280388
      Icon for Resolver II rankResolver II

      Anonymous Thanks for the response.

       

      I created the index column and added the measure. but it gives the wrong name.  Could you please let me know the index should be on Employee ID?  its not giving right answer.

      Also, the hierarchy slicer has Manager Name and Manager's Manager name as Level2 and Level1.

      • Anonymous's avatar
        Anonymous
        Not applicable

         LP280388 Share your sample pbix file

        Yes you should create index on based on Emp.