3 Replies Latest reply on Apr 14, 2016 2:29 PM by Joe Oppelt

    using action to change parameter

    Dan Winnowski

      Hi.  I'm trying to use an action on one sheet to control the line graph on another sheet.


      Attached is a mock up of my setup.  I want a user to be able to click on "Pct5" or "Pct5a" and have the line graph below update according to their selection.


      I'm not sure it's possible because of the way the data comes through as separate fields for 5 and 5a.  Perhaps there's another way to achieve this result?

        • 1. Re: using action to change parameter
          Patrick A Van Der Hyde

          Hello Dan,


          Thank you for sharing a workbook with sample data.  Knowing a bit about the data source involved here would help a bunch in determining options.  I would create a view by modifying the data source.  In the attached workbook, I have copied the data source and removed all fields except Date,Facility, the Category and the Category Type (5 or 5a).  I then pivoted the data so that we create a single Category Type field.  This eliminates the need to utilize Measure Names/Values which is causing the problems encountered and we can instead directly address the Categories.


          Once the data is pivoted, we can create a three new calculations:

          Den  - If [Category]="D" or [Category]="E" then 1 else 0 END

          Num - If [Category]="E" then 1 else 0 END


          and PCT - sum([Num])/sum([Den])


          and with these fields we can create the same two views originally in the attached workbook.  The advantages is that we can create a Action Filter from the crosstab view to the line chart based on selecting a Category Type (5a or 5)  and have the associated line chart appear.  We can also set the filter to exclude all values when nothing is selected, in which case the line chart will disappear.


          The attached workbook is in ver 9.3 of Tableau.  The solution depends on the data source being one that can be pivoted though so start there and determine if this is possible.



          • 2. Re: using action to change parameter
            Joe Oppelt

            Dan -- I created two sheets:  One that displays Pct5, and one that displays Pct5a.  Then I did sheet swapping based on the value of the parameter.


            Is this what you are looking for?


            Actually, if the difference between the two sheets is just a matter of measure values, you could create a calc that says:


            if [parameter]="this" then [this-measure] elseif

            [parameter]="that" then [that-measure] end


            And then just display the new calc.  (Or multiple calcs if there are multiple things to display based on the value of the param.  And you would only need one sheet, and not need swapping.


            But if you also have to change the display by DIMENSION as well, (such as 5Category vs 5aCategory) then you'd probably be better off with separate sheets.

            So the Dashboard2 in the attached is swapping the sheets in a container in the lower half based on the selection chosen in the parameter.


            If this is what you are aiming for, we can discuss how to do that.

            • 3. Re: using action to change parameter
              Joe Oppelt

              Just a point of protocol.  When you attach a sample workbook, it helps to specify the version of the workbook.  I had to try 3 versions before I found the one you created this in.  As you see in Patrick's reply, he just upgraded your workbook to 9.3 and then did his work.  If you don't have 9.3, you won't be able to see what he did.


              Stating the version up front saves a lot of trouble.