3 Replies Latest reply on Aug 20, 2018 8:49 AM by Jim Dehner

    Filtering To Current Hour

    Geoffrey Bell

      Trying to set up a data table that has today's data vs a previous day which is set by a parameter. Wondering if there is a way to filter to include all hours up to current hour to avoid comparing partial day (today) to full day (parameter date). I have two separate dimensions currently, eventDate and hour.

       

      Thanks,

        • 1. Re: Filtering To Current Hour
          Jim Dehner

          Good afternoon

          If you want to know the current hout the formula is      datepart('hour',NOW())    right now in Nashville is 3:57 pm and the formula returns 15

           

          you can use the formula in a t/f filter to datepart('hour',NOW())<= Hour (your hour dimension and it will filter to the hours from midnight to 15 (3 pm)

           

          but there is another issue - you are suggesting that you are using a parameter to Identify the current / previous day?  Parameters are static values chosen from a list by the user - they are not dynamic - if you want today you can use the function Today()  and yesterday is Today()-1 - tose can be mixed with other date formulas similar to the Hour formula above or simply as           (Date)=Today() OR (Date)=Today()-1

           

          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.

          1 of 1 people found this helpful
          • 2. Re: Filtering To Current Hour
            Geoffrey Bell

            Thanks Jim. That "now()" function looks like it's what I'm looking for.

             

            I think I explained it poorly but the parameter is used to pull a stats for a comparison date. So I have for example Today's Revenue as a column and then Δ Revenue as another column that pulls Revenue from the comparison date selected with the parameter.

             

            I've got that working as intended but needed the Now() function so that comparisons can be done on a partial day.

            • 3. Re: Filtering To Current Hour
              Jim Dehner

              Glad to help ou

              Jim