8 Replies Latest reply on Mar 30, 2016 1:44 PM by Angie Tarbet

    new to date parameters - need help

    Angie Tarbet

      Hi,

       

      I am sort of new to working with date parameters. I'd like to be able to filter my data by two time periods.

       

      9-1-2015 through 2-29-2016

       

      and then also the option to select

       

      3-1-2016 through 9-1-2016

       

      Is this a date parameter or should I be using filters? When I try to set a filter for the above date ranges all of my data disappears even though I know there is plenty of data in the ranges so how I got on the track of a date parameter.

       

      I do not have any fields with the above dates or ranges, so likely will need to create. Not sure how to do that either.

       

      Any suggestions are appreciated! Thank you! Angie

        • 1. Re: new to date parameters - need help
          Joe Oppelt

          Your question raises questions.

           

          When September 1, 2016 rolls around, are you expecting to stop using this sheet?  (I would guess not.)

           

          Chances are, you want the user to be able to indicate which half-hear you want to see, and for which fiscal year you want to do that.

           

          I would so something like that with parameters (especially if the data to be retrieved is going to come from multiple data sources) and then create a calc to be used as a filter based on the parameter selections.

           

          The calc would look something like this:

           

          IF (insert condition here that would get the dates you want) then 1 else 0 end

           

          Put that on the filter shelf and select for value = 1.

           

          Your condition might look something like this

           

          [transaction date] >= [start date of the semester you want] and [transaction date] < [start-date of the next semester]

           

          If you are always going to hard-code 9/1 and 3/1 as the start dates of semesters, then it's just a matter of forcing the correct year values into these dates.  And I used [start-date of next semester] instead of trying to calc the end date of the current semester because in 2017 you don't want to be dealing with Feb 29.

          • 2. Re: new to date parameters - need help
            Angie Tarbet

            Hi Joe,

             

            Correct, the month and day are the important dates and I'd want the dashboard to work for future years.

             

            You are way ahead me in getting this created with my data!

             

            I am having trouble getting the parameter started let alone the calculated field you mention (which I will try).

             

            I was assuming that the parameter would be a date range, but am now not sure this is correct way to go per your reply.

             

            What type of parameter would you use? I only have the two ranges that I'd need as selections for my users noted below.

             

            9/1/2015 through 2/29/2016 = Mid Year

            3/1/2016 through 8/31/2016 = Year End

             

            As mentioned before, I'm not too familiar with dates in Tableau and do not have any of the above as data fields so starting from beginning.

            • 3. Re: new to date parameters - need help
              Joe Oppelt

              I would have one parameter that chooses between mid-year and year-end.  Also I would have some way to specify which year to look at.

               

              your start-of-range calc would do this:

               

              Start of current range:

               

              DATE(

              if [range parameter] = "Year End" then

              "3/1/"+str([year parameter])

              else

              "9/1/"+str([year parameter]-1)

              end

              )

               

              Notice that I wrapped the whole thing in the DATE() function.  I'm doing string stuff to build the date, but then when you wrap the whole thing in DATE() the output is really a date value.

               

              I didn't test this out.  Just typed it off the top of my head.  So there might be some syntax issue in there.  If I had a packaged workbook I could work with you on building this.

               

              And once you have your Start of current range, you can calc your start of next range by doing this:

               

              DATEADD('month',6,[Start of current range])

               

              That just adds 6 months to the start date.

              • 4. Re: new to date parameters - need help
                Angie Tarbet

                Attached is a scrubbed workbook per your reply. I am also trying your suggestions above. Thanks Joe.

                • 5. Re: new to date parameters - need help
                  Joe Oppelt

                  Wow.  That's REALLY scrubbed!    Your data has only 3 rows, with one column:  ARD.

                   

                  No dates.  No measures.


                  Just this:

                   

                  ARD   Number of Records

                  John    1

                  Mike    1

                  Joe      1

                   

                  See if you can incorporate what I described, and we can take next steps at that point.

                  • 6. Re: new to date parameters - need help
                    Angie Tarbet

                    I'm working from a different workbook. I'll try it and circle back.

                    • 7. Re: new to date parameters - need help
                      Łukasz Majewski

                      The data you attached consists of 3 strings only...

                      Not sure what you are trying to get to but you may create a convenient range filter out of continuous date field:

                          

                      • 8. Re: new to date parameters - need help
                        Angie Tarbet

                        That is how I started, but when I drop this filter on my report all the data disappears so then I got into the date parameters (which seem really complicated). Thanks.