3 Replies Latest reply on Nov 15, 2016 2:44 PM by John Lee

    Use one Parameter to define another parameter

    John Lee

      Hello all - brand new Tableau user & first post here (so apologies if I make newbie mistakes!)


      I have a dashboard that charts revenue (for simplicity, my data contains:  invoice number, invoice date, invoice amount).  I'm using 2 parameters called:  Period & Prev Period

      - period is a list of strings:  month, quarter, date

      - prev period is a list of integers:  1,2,3,12

      What my worksheets are doing is using these parameters to chart:

      - what is my month/quarter/year to date sum total of revenue

      - how does my current month/quarter/year to date revenue compare to:

           - the immediate previous month/quarter/year revenue (i.e. 1 month or 1 quarter or 1 year ago)

           - 'x' number of month/quarter/year revenue (i.e. same month last year, same quarter last year.... etc)


      It does this by using the first parameter (month/quarter/year) to define the period-to-date that i'm looking at.  It then uses the 2nd parameter to count 'x' number of 'periods' to go back.  What I would like to do is to either consolidate this into a single parameter control, or have the selection of the first parameter to populate the list of selections in the 2nd parameter.



      Today is Nov. 14th and I:

      - select 'month' as my first parameter

      - 1 as my second parameter

      (this will give me November's revenue up to the 14th, and also show october's revenue to october 14th)

      - I can also change the 2nd parameter to 12 which shows me MTD revenue up to 2016-11-14 and MTD revenue up to 2015-11-14

      *** but it requires that the user change both paramater 1 and parameter 2

      (i.e. it doesn't make sense to show YTD revenue and compare it to 12 years ago's YTD)



      What i would like is to dynamically use parameter 1 to define what shows up in parameter 2's parameter control

      - i.e.  if i select 'month' for parameter 1, i want to show 'last month's MTD' & 'last year's MTD' as drop downs for parameter 2

      - i.e.  if i select 'quarter' for parameter 1, i want to show 'last quarter's QTD' and 'last year's QTD' as drop downs for parameter 2


      This is a LOT of words...  i hope it makes sense and i hope there is a way to get what i want...

        • 1. Re: Use one Parameter to define another parameter
          D Barnetson

          Hi John,


          As far as I'm aware, there wouldn't likely be a way to have a parameter change its values.


          You might be better off trying to show and hide (or pop sheets) parameters:


          We made a video of Sheet Swapping and Legend/Filter Popping on a dashboard.


          This will allow you to direct the user to the specific parameter based on the selection of your first parameter.


          The other possible option might be to create a calculated field that you could use quick filter that would work with your main parameter, based on the users selection, though you may find the link above more helpful.


          Hope this helps.


          • 2. Re: Use one Parameter to define another parameter
            Stephen Rizzo

            I don't think you can do what you asking for with two parameter controls. Parameters in Tableau are static in the sense that once you set what the list of possible values are, that list cannot change (unless you go in and modify it in Tableau Desktop yourself).


            I can think of a way to create what you are looking for using filters; however, the process to do so only works if you don't have a huge amount of data. If it were up to me I would look for simpler alternatives, such as leaving the parameters as is (maybe changing the titles to "Period" and "Number of Periods Look Back") and using a calculated field based on the parameter values to create custom titles for your charts ("Last Month's MTD" for example).

            • 3. Re: Use one Parameter to define another parameter
              John Lee

              Thanks D Barnetson and Stephen Rizzo,

              I kinda figured that it would be hard to do - was hoping that that it wasn't impossible.  I've looked at both of your suggestions and I think there is something I can try to do.


              Thanks again!