Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Multiple conditons in where clause

  Hi,

   

      How can we put multilple conditions in where clause on load script. in below script i have to write two conditions in where clause like where CYEAR< year(today()) and CYEAR>year(Today())-3

load
V.SEGMENT as segment,
CYEAR as Year,
MARKET1 as Market,
Resident V
where CYEAR < year(Today())-3;

7 Replies
jagannalla
Partner - Specialist III
Partner - Specialist III

Where CYEAR >Year(Today())-3 and CYEAR< Year(Today())

Not applicable
Author

Jagan,

      i have tried with AND but its not working. is this because of resident load?

richard_pearce6
Partner - Specialist
Partner - Specialist

You can also enclose them in brackets if you need to add any 'or' statements at a later date

load
V.SEGMENT as segment,
CYEAR as Year,
MARKET1 as Market,
Resident V
where (CYEAR > year(Today())-3 and CYEAR < year(Today())  );

Anonymous
Not applicable
Author

I would use brackets to separate the 2 conditons between "and"

where ((CYEAR>year(today()-3) and (CYEAR<year(today()))


its_anandrjs
Champion III
Champion III

Try to use like

Let vCurrYear = Year(Today());

Let vPrevYear = Year(Today())-3;

load
V.SEGMENT as segment,
CYEAR as Year,
MARKET1 as Market,
Resident V
where (( CYEAR > $(vPrevYear) ) and  ( CYEAR < $(vCurrYear)  ) );


Hope this helps

maxgro
MVP
MVP

and works with resident load

where CYEAR > year(today()) - 3 and CYEAR < year(Today())

antoniotiman
Master III
Master III

Try

CYEAR > (year(today()) -3) and ....