2 Replies Latest reply on Jul 10, 2017 1:38 PM by Tom W

    Time Period Parameter

    Steve Morrison

      Hey,

       

      I am looking to be able to have a parameter button that allows the user to change the view according to if they want to see monthly data or annual data.

       

      For example, with a bar chart, if I have 2 years worth of data and a user selects annual, they would see a bar chart with two bars. If they select monthly, they would see 24 bars.

       

      Thanks,

        • 1. Re: Time Period Parameter
          Tom W

          Hi Steve,

          Take a look at my answer here;

          https://community.tableau.com/message/639366

           

          Slight modification to that, you need to create a parameter for your periods, then a calculated field called 'TimePeriod' or something similar to show on the rows shelf in the report like IF parameter = "month" then MONTH(Order Date) elseif parameter = "year" then YEAR(Order Date) end

          • 2. Re: Time Period Parameter
            Diego Martinez

            Tom answer is very useful, but you probably want to modify the calculated field and concatenate the Month and Year in case "month" option in the parameter is selected:

             

            IF parameter = "month" then STR(YEAR([Order Date]))+"-"+STR(MONTH([Order Date]))

            ELSEIF parameter = "year" then STR(YEAR([Order Date]))

            End

             

            To create a parameter, right clic on a blank space on the dimension panel, create, parameter.  Choose a string parameter, type list, and enter the two values "month" and "year".

             

            Diego Martinez

            Tableau Partner Colombia

            www.modux.co

            1 of 1 people found this helpful