Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

why doesn't this work?

if(Created_On=>'01.04.2010' or Created_On<='31.03.2011','10/11',

if(Created_On=>'01.04.2011' or Created_On<='31.03.2012','11/12')) as COD

7 Replies
chandashok
Contributor III

why doesn't this work?

Hi

     May be the date  format is mismatched.

     You will try using the num() function before your operands.

i.e

example

     num(created_On) => num(01.04.2010)  ....

Regards

Ashok

MVP & Luminary
MVP & Luminary

why doesn't this work?

Hi,

You have to use '>=' instead of '=>', and one more thing both the date formats should be same.

if(Created_On >= '01.04.2010' or Created_On <= '31.03.2011','10/11',

if(Created_On >= '01.04.2011' or Created_On <= '31.03.2012','11/12')) as COD

Hope this helps you.

Regards,

Jagan.

why doesn't this work?

Hi,

Try with this

    

if(Created_On>= Date(Date#('01.04.2010')) and Created_On<=Date(Date#('31.03.2011')),'10/11',

if(Created_On>=Date(Date#('01.04.2011')) and Created_On<=Date(Date#('31.03.2012')),'11/12')) as COD

Hope it helps

Celambarasan

rahulgupta
Contributor III

why doesn't this work?

Hey Hi,

Use this

if(Date(Created_On,'DD.MM.YYYY') =>'01.04.2010' or  Date(Created_On,'DD.MM.YYYY') <='31.03.2011','10/11',

if(Date(Created_On,'DD.MM.YYYY')=>'01.04.2011' or  Date(Created_On,'DD.MM.YYYY')<='31.03.2012','11/12')) as COD

Regards

Rahul Gupta

flipside
Valued Contributor II

why doesn't this work?

If you want a more dynamic option, I use something like this which means you don't have to keep going back to add/change the date test values, it just uses the actual year in the date ...

YrMap:
MAPPING LOAD * INLINE [
    Month, Adjust
    1,-1
    2,-1
    3,-1];

Data:
LOAD * INLINE [
    Date
    01/01/2010
    23/02/2011
    03/06/2010
    01/04/2011
    31/03/2011
];

FiscalData:
LOAD
Date as FiscalDate,
Right(Year(Date) + ApplyMap('YrMap',Month(Date),0),2)
  & '/' & Right(Year(Date) + ApplyMap('YrMap',Month(Date),0)+1,2) as FiscalYr
RESIDENT Data;

flipside

Not applicable

why doesn't this work?

get

Error in expression:
')' expected
IFLOT:
LOAD Functional_Location,
     Waste_Water_Receiver,

if(Date(Created_On,'YYYY-MM-DD') =>'2010-04-01' or  Date(Created_On,'YYYY-MM-DD') <='2011-03-31','10/11',
if(Date(Created_On,'YYYY-MM-DD')=>'2011-04-01' or  Date(Created_On,'YYYY-MM-DD')<='2012-03-31','11/12')) as COD


so no good

Not applicable

why doesn't this work?

you need to use >= and not =>