Forum Discussion

Ashok_Gopeani's avatar
2 years ago
Solved

Display columns in Matrix visual based on selection in the hierarchy slicer

Hello Team,

 

we have one hierarchy slicer with country- state-district combination and matrix visual. Based on the selection in slicer the respective columns are going to add or display in matrix visual like below

 

Actually whenever we are selecting district values from slicer functionality is working as expeted but we try to select country or state values in the matrix visual getting disapear like below

 

i have return measure and refered in matrix but some what its not working expected. i am attaching my pbix file here for better understanding the issue in below drive link. it would be great if you would verify and provide the solution

 

https://drive.google.com/drive/folders/1E3z9e6HRRknQlcdIfmtsb-dJb72q5kQ6?usp=drive_link

 

Thank you in advance 

 

 

 

  • Hi Ashok_Gopeani 

    Please update the measure 

     

    selectHierarchy = SWITCH(
        TRUE(),
        ISFILTERED(Country[District]) || ISFILTERED(Country[State]),1,0)

     

     


    Let me know if that works for you


    If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.

    Thanks
    Pijush
    Linkedin

4 Replies

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

    Hi Ashok_Gopeani 

    Please update the measure 

     

    selectHierarchy = SWITCH(
        TRUE(),
        ISFILTERED(Country[District]) || ISFILTERED(Country[State]),1,0)

     

     


    Let me know if that works for you


    If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.

    Thanks
    Pijush
    Linkedin

  • Hi Ashok_Gopeani ,
    Using the pbix you shared i created a similar matrix with the columns you are using, the only difference being the flag that you are using selectHierarchy is casuing that issue.

    selectHierarchy = IF(ISFILTERED(Country[Country]),IF(ISFILTERED(Country[State]),IF(ISFILTERED(Country[District]),1,0),0),0) 


    According to the measure it'll only return 1 when a district is selected and hence wont work for state and country.
    Try removing that filter from the filter pane. Then the desried functionality works fine :


    If your requirement is solved, please make THIS ANSWER as SOLUTION and help other users find the solution quickly. Please hit the LIKE button if this comment helps you. 😊




    • Ashok_Gopeani's avatar
      Ashok_Gopeani
      Icon for Helper I rankHelper I

      Hi Gayatri_D05 ,

       

      i intionally keep that measure on matrix visual as it is dispaying all values if we keep slicer without selection. so we should keep some valid measure that should allow to dispaly columns in matrix whe we select the value in slicer only. and also matrix should display values on any sort of selection in slicer

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

        Hi Ashok_Gopeani , Okay then i would suggest changing the logic of the measure. tahts the only thing holding the visual back.