Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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.

4 Replies
MK_QSL
MVP
MVP

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


or


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

jagan
Luminary Alumni
Luminary Alumni

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.

Not applicable
Author

hi anil,

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

msteedle
Luminary Alumni
Luminary Alumni

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.