3 Replies Latest reply on Aug 10, 2018 10:56 AM by Jeff Grant

    Count Number of Days

    Jeff Grant

      Hi - Newbie here. attached is a subset of a workbook with max and min temperatures from central park nyc from 1869-2017.

       

      I have 3 date ranges I'd like to explore:

      1/1/1967 - 12/31/2017

      1/1/1916 - 12/31/1966

      1/1/1869 - 12/31/1965

       

      On the same sheet I'd like to show the number of days (Count) where the Max Temp exceeded 90 degrees for the 3 date ranges in a bar chart (3 bars).

      I've messed with a number of ways but still being green, i can't figure out the combination of parameters or calculated fields.

       

      Looking for some help.

      Thanks in advance

        • 1. Re: Count Number of Days
          Jim Dehner

          hi Jeff

          see the attached

           

          first welcome to tableau and thanks for including your workbook

          a word about filters - they to just that - filter data out of the viz - so trying to apply a slider to look at date ranges is not going to work

           

          I read your post several times and assumed that you really wanted 3 consecutive dates - if you really wanted overlapping dates that will make the solution must more complex

          but  this creates 3 groups

          and this will place a counter on max tem >90 (note this could be a parameter to select a date)

           

           

          and this is the viz

           

           

          Jim

           

          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: Count Number of Days
            Simon Runc

            hi Jeff,

             

            As your date ranges overlap...I think we need create separate measures for  each date range and temp > 90.

             

            Btw I've had coded the date ranged, before realizing they were full years, so use Jim's YEAR method instead!

             

            So I created True/False for each Date Range

            eg

            [Date Range 1/1/1869 - 12/31/1965]

            [Date] >= #01/01/1869# AND

            [Date] <= #12/31/1965#

             

            I then used these to create a field which only contains dates, within each date range, where the Max was over 90.

             

            [Max Temp > 90 1869-1965]

            COUNTD(IF [Date Range 1/1/1869 - 12/31/1965] AND

            [Max Temp] > 90 THEN [Date] END)

             

            and then used measure names/values to plot each of them on the same chart,

             

            Hope that makes sense and helps,

            • 3. Re: Count Number of Days
              Jeff Grant

              thanks for your help. You nailed it. I wanted three data ranges and the ability to count based on a certain threshold.

               

              Thanks again.