8 Replies Latest reply on Dec 15, 2016 2:09 PM by Josh Delekta

    Integrating Dynamic Marks with Dashboard Filters

    Josh Delekta

      Hello,

       

      Please see attached. The current state of my dashboard has an area chart and text table that is connected to the same data source and is controlled by filters displayed on the right hand side.  The area chart has the field "Approver" on the color mark to show each approver's slice of the data. If a user selects any of filter it continues to show the "Approver" field on the color mark as you would expect. I am looking to get your thoughts on how best to accomplish the following:

       

      The user select's an approver from the "Approver" filter and the area chart shows the color mark slices for "Subplatform 1"

      The user selects "All" from the "Approver" filter and the area chart shows the color mark slices for "Approver"

       

      Is there some type of IF THEN statement I can employ in this situation? I'd like to start there and I'd also like to be able to use the color mark when a user selects the "Billing Status" as well but I'm not sure how to clear that selection if the user decides to start trying to use another filter with not clearing the "Billing Status" filter. I'd appreciate any thoughts on how to best accomplish this "dynamic filtering"

       

      Thank you!

        • 1. Re: Integrating Dynamic Marks with Dashboard Filters
          Stephen Rizzo

          Interesting question. You could create a parameter that controls which field is used to determine the color, specifically

           

          [Color] : IF [Color Parameter] = "Approver" THEN [Approver] ELSE [Subplatform 1] END

           

          Another option would be to have two copies of the chart, each with a different field for the color, then hide or show the appropriate chart based on whether a value is selected in the filter. You can test whether (All) is selected using the following calculation:

           

          IF COUNTD([Approver]) = ATTR({FIXED : COUNTD([Approver])}) THEN MIN(1) ELSE MIN(2) END

           

          The reason this formula doesn't work to simply swap out fields is because it uses an aggregate in the IF condition, so Tableau requires that the values be aggregate as well.

          • 2. Re: Integrating Dynamic Marks with Dashboard Filters
            Josh Delekta

            Stephen,

             

            Thank you for following up. I'm not certain of how to employ your first suggestion:

             

            - I currently have a parameter to show billed versus unbilled. Are you suggesting I create another parameter utilizing the approvers names and if its "All" then it shows "Approver" otherwise it shows "Subplatform"? Otherwise, I'm not certain how to create the color parameter.

             

            Please let me know. Thank you!

            • 3. Re: Integrating Dynamic Marks with Dashboard Filters
              Stephen Rizzo

              I was thinking of something simpler. Consider a parameter with the following true values / display values:

               

              [Color Parameter] : 1 - Approver, 2 - Subplatform 1

               

              And the calculated field

               

              [Color] : IF [Color Parameter] = 1 THEN [Approver] ELSE [Subplatform 1] END

               

              It's not automatic, but it does allow the end user to change the color field and is extremely easy to implement.

              • 4. Re: Integrating Dynamic Marks with Dashboard Filters
                Josh Delekta

                Stephen,

                 

                It does sound simple but I'm lost in how to implement. Is the parameter a string like this? Then I add the calculation to the color mark? I'm trying to understand the logic also beneath it. The calculation is stating that if you select a specific approver from the filter the color mark will change to "Subplatform 1"? If you return to no filter on "Approvers" then the color mark returns to "Approver"? Thank you for your help.

                 

                 

                • 5. Re: Integrating Dynamic Marks with Dashboard Filters
                  Stephen Rizzo

                  The way that I would think about the calculated field is that if the user selects "Approver" (which Tableau interprets as the integer 1 - see how the parameter is set up in the attached example) from the drop parameter down menu, then [Color] will be equivalent to the [Approver] field. Otherwise [Color] will be equivalent to [Subplatform 1]. I added the parameter to your example dashboard - hopefully being able to look at an example will help you better understand what is going on behind the scenes.

                  1 of 1 people found this helpful
                  • 6. Re: Integrating Dynamic Marks with Dashboard Filters
                    Josh Delekta

                    Excellent! Thank you. I didn't realize that your solution revolved around the user making the selection. I like this a lot and I've started to add more dimensions to the code you provided. Do you know if there is a way, by default, where the "Color Parameter" would switch to "Subplatform 1" if the user selected any choice other than "All" and would revert back if they selected "All"?

                    • 7. Re: Integrating Dynamic Marks with Dashboard Filters
                      Stephen Rizzo

                      Unfortunately I don't think that that is possible. To the best of my knowledge parameters can't change based on filter selections.

                       

                      As I mentioned in my first post, the problem with having a field that switches automatically is that you need to count the number of approvers selected in order to tell what the filter setting is. Because that requires an aggregate, the if statement checking the number of approvers needs to output an aggregate as well.

                      • 8. Re: Integrating Dynamic Marks with Dashboard Filters
                        Josh Delekta

                        Got it! Thank you for the help. I appreciate it.