1 Reply Latest reply on Oct 9, 2012 11:59 AM by Tracy Rodgers

    Create parameter to choose time frame?

    David Shaw

      Hello,

       

      I was wondering if it is possible to create a parameter to allow the user to pick a time frame on a dashboard? I've created the following:

       

      CASE [Parameters].[Pick Time Frame]

      WHEN "Week" THEN DATEPART( 'week',[date])

      WHEN "Month" THEN MONTH([date])

      WHEN "Year" THEN YEAR([date])

      END

       

      I think use this calculated field as the columns on my graph and add the parameter control to the dashboard. This works but has a few issues:

       

      1. With my dates I'm trying to have a fiscal year start date of October, but then the week number output on my graphs does not take account of this fiscal year choice. This is the same issue for year too - data is split over calendar year and not financial year.

      2. Months are shown as numbers and not actual months (i.e. 4, 5, 6 instead of April, May and June). The main downside to this is that months are then ordered by number and not by the financial year calendar. Eg. November and December need to come before September and not after (see screenshot below).

       

      Does anyone have any suggestions for how to improve this?

       

      Thanks!

       

      tableau.PNG

        • 1. Re: Create parameter to choose time frame?
          Tracy Rodgers

          Hi David,

           

          For the first issue, you might be able to use the dateadd function so get the appropriate fiscal year start. For the second issue, use datename, similar to the following:

           

          CASE [Parameters].[Pick Time Frame]

          WHEN "Week" THEN DATENAME( 'week',[date])

          WHEN "Month" THEN DATENAME( 'month',[date])

          WHEN "Year" THEN DATENAME( 'year',[date])

          END

           

          Hope this helps!

           

          -Tracy