4 Replies Latest reply on Dec 29, 2016 9:21 AM by Joe Oppelt

    How to dynamically hide a column when it has no value?

    Bob Liu

      Hello, I have dataset with multiple level of information,like Level 1, Level 2, Level 3. Some attributes have 3 levels of information while others only have 2. So if I filter to an attribute with only 2 levels of information, I only get null values in level 3. Is there anyway to automatically hide a column when it is only has null values?

       

      Thanks

        • 1. Re: How to dynamically hide a column when it has no value?
          Joe Oppelt

          Tableau stakes out the space for pills you put on rows/columns.  End of story.

           

          But you can hack some ways to hide it.  Can you supply a small data set and a sample workbook?  We can work through some ideas together.  I have two things in mind.  (Let me know what version of Tableau you are using so we can work in the same version.)

          • 2. Re: How to dynamically hide a column when it has no value?
            Bob Liu

            Hi Joe,

             

            I attached a sample workbook I to my original post. Essentially, when filtering to M07 account type, I want the Level 3 column to disappear.

             

            Thanks,

            • 3. Re: How to dynamically hide a column when it has no value?
              Christina Davis

              Hi Bob,

              Attached is a quick hack. I didn't have a lot of time so it's not the cleanest but it should give you a good idea of one option. I built out three worksheets, one is simply a filter that applies to all sheets using the data source. You then have a worksheet showing all 3 columns and one showing just two columns. By creating a copy of the field Account Type you can add a secondary filter to each of your sheets, on the three column sheet I filtered out the account types with no Level 3 data and on the two column sheet I filtered out account types with Level 3 data.

               

              Now on the dashboard you add your universal filter box and it will drive which of your 2 charts show up. You can clean this up a lot to make it look more streamline it all depends on what your real data looks like and what else you plan on showing.

               

              If need be you can also create a calculated field that determines if it is a 2 or 3 column account type and then use that to drive the filtering (with just two account type in your sample it was unnecessary to do this).

               

              Hope this helps!

              • 4. Re: How to dynamically hide a column when it has no value?
                Joe Oppelt

                I took Christina's example and did what I was going to suggest:

                 

                Use sheet swapping.

                 

                You drag the two sheets into a container.  I used COUNT([Level 3]) to filter each sheet.  If zero, then display the 2-column sheet.  If at least 1 (then we have level 3 data) then display the 3-column sheet.