3 Replies Latest reply on Sep 15, 2018 10:12 AM by sujit patel

    Regarding Date

    sujit patel

      i created a parameter string .

      datatype- string

      two values - 2014,2015


      so when i going to select 2014, then it should show ytd of 2014

      and if 2015 then the same ytd


      how to link that string parameter to date

        • 1. Re: Regarding Date
          Jim Dehner

          Good morning

          Parameters are the way users can input a fixed value into tableau but they do not do anything themselves - they have to be backed up with a calculated field or a filter


          you didn't provide a twbx workbook so I can't see your data or the viz - I am interested in why you chose to use string for the parameter rather than date or integer -

          but given that you did and assuming you have a dimension [Date] that is actually a date then you can create a calculation as shown in this superstore example



          it will return this





          If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

          • 2. Re: Regarding Date
            Ankit Bansal



            For ytd you can use below formula based on yr parameter:


            year([date])=int([param year]) and DATEPART('dayofyear',[date])) <= DATEPART('dayofyear',today())


            Hope it helps.



            Ankit Bansal

            • 3. Re: Regarding Date
              sujit patel

              Thanx, I will try and revert back


              On Sat 15 Sep, 2018, 9:28 PM Ankit Bansal, <tableaucommunity@tableau.com>