4 Replies Latest reply: Nov 21, 2012 2:11 PM by marcokiesewetter RSS

    Condition based on today's date?

      Hi All,


      I am trying to restrict a table to show only rows of data where a date column (let's call it EndDate) is greater or equal to today (the day when the document is viewed or at least when it was last updated works for me).


      I didn't seem to get a condition in so I tried to create a new variable that compares EndDate from my data source to today's date and returns NULL if it is outside that range. The functions people talk about in these forums are today() and now() but neither really seems to work.


      How can I add such a column to my data? In the script I tried somthing like this:


      if([EndDate] >= today() and [EndDate] <= today()+30, [EndDate], NULL() ) as DuringNext30


      The example above is something I imagined working but it didn't.


      even something like:


      today() as TodaysDate


      didn't work. I guess I am trying some functions that may have a different name I don't know?


      Thank You for your help!



        • Re: Condition based on today's date?

          In particular I want to show 3 different tables that do not analyze or calculate anything.


          I want to show

               one table with EndDate >= today and EndDate <= today+30

               one table with EndDate > today+30

               one table with EndDate < today


          so I don't want to alter the dataset for the whole document, just for the table objects.


          This really feels like such a rookie question but I am stuck. Just starting out with QlikView.



            • Re: Condition based on today's date?



              First check the format of the enddate and today() are same are not


              if both are same format then use the cond

              otherwise use the conversion functions like date,timestamp


              in ur exp instead of today()+30 use below expr



              if([EndDate] >= date(today()) and [EndDate] <= date(today()+30), [EndDate], NULL() )

                • Re: Condition based on today's date?

                  Hm, I get an error telling me I have invalid data near the if statement.


                  Before QlikView I used iNetSoft and there I could simply add any condition to any sheet object. I could right-clik on it and select condition and then say: Of all the lines of data, use only those where EndDate >= today. This was based on the object, not the whole sheet, so I could use different conditions for each table and chart.


                  This is what I want to do here. I'm sure it's possible and probably the solution is better than the one in iNetSoft. However, I just can't find where I can set this up.