4 Replies Latest reply: Mar 6, 2014 8:45 AM by Michael Steedle RSS

    Date comparison not working

      I have a variable

      vCurrPeriodEnd , vCurrPeriodStart date variable

       

      VPrevPeriodEnd =if(_CompareType='Year over Year',

      date(AddYears(vCurrPeriodEnd,-1))

      ,date(vCurrPeriodStart-1))

       

      and I am using it like this

      Period={">=$(=$(Daystart(vPrevPeriodStart)))<=$(=$(Daystart(vPrevPeriodEnd)))"}

      I am putting this in a Set analysis and its not working.

        • Re: Date comparison not working
          Manish Kachhia

          Period={">=$(=$(Daystart('vPrevPeriodStart')))<=$(=$(Daystart('vPrevPeriodEnd')))"}


          or


          Period = {'>=$(Daystart('vPrevPeriodStart')) <= $(=Daystart('vPrevPeriodEnd'))'}

          • Re: Date comparison not working
            jagan mohan rao appala

            Hi,

             

            The formats are same for Daystart(vPrevPeriodStart) and Period dimension, if they are not same then convert by using

             

            Date(Date#(Period, "DateFormat")) or Timestamp(TimeStamp#(Period, "DateFormat"))

             

            Regards,

            Jagan.

            • Re: Date comparison not working

              hi anil,

              please check your both dates in Text box, look whether both they  are in Same format

              • Re: Date comparison not working
                Michael Steedle

                There is no such things as a date variable in QlikView, as variables do not have data types. That may be part of the problem, as date comparisons in Set Analysis require you to have identical formatting between the field and the comparison value (your variable), which may not match in your application.

                 

                I would suggest plugging that formula into the expression of a straight table. Do not give the expression a label, and the expression label will show your formula after dollar sign expansion/text replacement, helping you see how QlikView is evaluating your logic.

                 

                There's not enough information about your data, variables, or their values and formatting to definitively answer your question.