Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Hiding Columns based on Filter

Hi All,

 

I am having a table as show below in Power BI Desktop Canvas,

 

I have set a filter on "Segemt" column in the Canvas. Now, If i select "Gift" in segment then only Columns "Store", "Segment", "Mug", "Pen" and "Doll" should be shown. Similarly, When I select "Stationary" then columns "Store", "Segment", "Pen" and "Note" only should be displayed and remaining columns should be hidden.

 

I have'nt got any blogs or post in online to perform the above functionality. So, I am posting here to know whether is there a way to do it in Power BI.

 

Thanks in advance.

 

Regards,

Mohanraj

  • Hi, Anonymous 

    Based on your description, it is unavailable to use the origin table data in the scenario. As a workaround, you can operate as following steps to achieve your requirement. I created data to reproduce your scenario.

     

    You can click ‘Edit Query’, go to Query Editor, choose ‘Transform’, replace ‘0’ with ‘null’ in the table, click on 'Store','Segment' columns,click ‘Unpivot other Columns’, choose ‘Unpivot Other Columns’, click ‘Close and Apply’.

     

    Finally, you may use the matrix visual to show the result and configure as follows.

    If I misunderstand you thought, please show me your expected output. I am glad to solve the problem for you.

     

    Best Regards,

    Allan

     

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

5 Replies

  • v-alq-msft's avatar
    v-alq-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

    Based on your description, it is unavailable to use the origin table data in the scenario. As a workaround, you can operate as following steps to achieve your requirement. I created data to reproduce your scenario.

     

    You can click ‘Edit Query’, go to Query Editor, choose ‘Transform’, replace ‘0’ with ‘null’ in the table, click on 'Store','Segment' columns,click ‘Unpivot other Columns’, choose ‘Unpivot Other Columns’, click ‘Close and Apply’.

     

    Finally, you may use the matrix visual to show the result and configure as follows.

    If I misunderstand you thought, please show me your expected output. I am glad to solve the problem for you.

     

    Best Regards,

    Allan

     

    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

      Thanks v-alq-msft for the quick workaround. To certain extend the solution was useful.

  • rajulshah's avatar
    rajulshah
    Icon for Resident Rockstar rankResident Rockstar

    Hello Anonymous ,

     

    Can you provide basic structure involved for this visual?

    • Anonymous's avatar
      Anonymous
      Not applicable
      Hi rajulshah Basically the table which I have posted is the result of a table visual. Now, when I use a basic filter as I have mentioned in the mail the table structure should act in the way as I have mentioned in the post. Let me know in case if I didn't answer the question or misunderstood the question. Thanks, Mohanraj
      • rajulshah's avatar
        rajulshah
        Icon for Resident Rockstar rankResident Rockstar

        If the solution posted by v-alq-msft didn't work, please let me know if I can be helpful.

        Thanks.