8 Replies Latest reply on May 26, 2016 2:33 PM by Ray Antunez

    Date Parameter control for the Marks section

    Ray Antunez

      I'm wanting to create a parameter control for a date that will allow me to change it from Month, to Quarter, to Year.

      The Color parameter would be discrete, while the Label would be continuous.


      For example, in this image you see shows a loss curve over time. The lines are by QUARTER.


      I'm wanting to be able to adjust using a parameter from QUARTER to YEAR or MONTH.

      This image shows how without a parameter, you simply have to manually make that change...

      I'm hoping someone can help educate me on how to make this a parameter and still maintain the proper ending display as you see.



        • 1. Re: Date Parameter control for the Marks section
          msa s



          You can do this by dates in to filter shelf and then  right click show filter , or are you looking for something different


          • 2. Re: Date Parameter control for the Marks section
            Andrew Watson

            This post should guide you on the technique to use a parameter to select a time period and using the parameter within a calculated field to change the time period displayed. This post covers Week and Month but easily adapts for your situation. Business AnalyticsWeek and Month Date Hierarchies in Tableau, build a hierarchy Tableau

            • 3. Re: Date Parameter control for the Marks section
              Ray Antunez

              not quite what I was looking for msa s.

              I wasn't looking to filter months, years.

              I want to be able to create a quick parameter that would allow the user to change the marks from month, to quarter, to year.

              Notice in the image how I had to manually change from QUARTER to MONTH in the MARKS section, that way the display would show more granular info, but also carry over the proper labels and colors for each line.

              • 4. Re: Date Parameter control for the Marks section
                Ray Antunez

                tried to follow this, but it either doesn't fit what I'm looking for or its just over my head. 

                This seems to be modifying the timing that is on the columns.

                I already have that as a static item called [Loss Timing (Adjustable)].

                I want to leave the Columns and Rows alone.

                All I want to modify are the fields in the Marks area...

                I'm wanting to see if a parameter can be created for someone that can simply choose Month, Quarter, or Year and it will change that setting for the marks. That way you can see in the initial 2 images up top where you saw 4 lines (quarters for 2012) then became 12 lines (months for 2012).

                Hope that all makes sense. I'm not on point with all the tableau lingo just yet. 

                I'm just a simple caveman...

                marks box.png

                • 5. Re: Date Parameter control for the Marks section
                  Andrew Watson

                  The link provided should help but I'l try and describe here as well. You will need to modify the calculated field somewhat to handle the formatting of your date but you should get the principle of it here.


                  Create your parameter with the values month, quarter and year. Case sensitivity is important here but you can display the numbers with caps where appropriate.


                  Create a calculated field with the formula: DATEPART([ParameterField],[Date : funded]). Putting that field on the marks card should give you the number of bars expected. However this may not do the formatting part, in which case you would have to create another calculated field (or replace the previous one just created) to format the date appropriately - i.e. IF [ParameterField] != 'year' THEN DATENAME([ParameterField],[Date : funded]) + ' ' + STR(YEAR([Date : funded])) ELSE STR(YEAR([Date : funded])) END


                  I'm not in front of tableau now to test any of this but it should (hopefully) work.

                  1 of 1 people found this helpful
                  • 6. Re: Date Parameter control for the Marks section
                    Ray Antunez

                    Totally makes sense and I think we're getting close... the only snag is when I attempt to embed a parameter control within the DATEPART or DATENAME function, it gives me an error in the calculation


                    Argument 'Month' to DATENAME must specify a datepart ('year', 'month', etc)

                    Argument 'Month' to DATEPART must specify a datepart ('year', 'month', etc)


                    I hope there's a way around this... since it seems to be right on track for what I'm hoping to do.


                    • 7. Re: Date Parameter control for the Marks section
                      Ray Antunez

                      I overlooked the case sensitivity, you were right on point there... fixed it to lower case strings and it worked cleanly when 'year' is selected.

                      I need to find a way to get it to display as a continuous variable, for the Label to show up clean.

                      The Dimension ends up goofing up how the curves look.



                      You've gotten me 75% of the way there, now just to get it to display the way I would prefer.

                      • 8. Re: Date Parameter control for the Marks section
                        Ray Antunez

                        figured it out, was able to simply go into the label properties and have it only label on the line ends and it still worked cleanly as a attribute instead of a dimension or a continuous variable. Appreciate the help. You took care of the tough part for me.