3 Replies Latest reply on Mar 3, 2017 11:25 AM by Blake Eno

    Changing color marks based on filter selections

    Blake Eno

      I've got a stacked bar chart and a filter called service group with three options (All, scholarly activities, and service activities). If "all" is chosen, I want color marks based on scholarly activities and service activities. So my stacked bar chart would have two colors. However, if I uncheck "All" and select on one of the other options, I want color marks based on what I call services (services are things like publications, presentations, etc contained within each service group). So in this scenario, my bars would have 3-5 colors. Hopefully this makes sense. I'm dealing with sensitive data so I'm unable to send a packed workbook. Thanks

        • 1. Re: Changing color marks based on filter selections
          Tom W

          Hi Blake,

          It shouldn't take much effort to prepare a Tableau Packaged Workbook based on some sample data you put into excel. Alternatively, you could create something similar using the samplestore data set.

          • 2. Re: Changing color marks based on filter selections
            David Blair

            Hi Blake,


            I'm assuming your data has a couple key columns:

            • Service Group (which designates whether the data is for Scholarly or Service activities)
            • Service Type (which contains the breakdown type you mentioned such as publication, research, etc.)


            One of the ways to accomplish this is with the combination of a parameter and a couple new calculations:


            • The parameter will contain the 3 options you mentioned (All, Scholarly, Service)
            • A calculated dimension that you can drop on the Color shelf
            • Another calculated dimension containing "Show" or "Hide" that you will drop on the Filters shelf


            The parameter will allow you to choose which of the 3 options you want to view the stacked bar chart by (All, Scholarly, Service).


            The "color" dimension will dynamically use the parameter to switch which dimension to use to break out color on the stacked bar (Scholarly Activities or Service Activities).


            The "filter" dimension will make sure that when Scholarly Activities or Service Activities are selected, only the appropriate breakdown information is shown in the bar chart.


            I've attached a mock-up workbook which shows how this could be accomplished.

            1 of 1 people found this helpful
            • 3. Re: Changing color marks based on filter selections
              Blake Eno

              Thanks, David. This is exactly what I was looking for. These Tableau forums are an excellent community. Thanks for being part of it.