Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Friends,
I have doubt in writing a expression, I have already written a expression in the below, which is working fine.
if(today() -[DATE] <= 0 ,'ONE', if(today() -[DATE] <= 30 ,'TWO', if(today () -[DATE] <= 60,'THREE', If(today ()- [DATE] <= 90, 'FOUR', 'REST')))) as [Aged];
My requirement is based on different customer like,400 and 54 Its not working for me,
Please help me how to do it.
If((CUSTOMER=400 then
if(today() -(INV_DATE+90) <= 0 ,'ONE', if(today() -(INV_DATE+90) <= 30 ,'TWO', if(today () -(INV_DATE+90) <= 60,'THREE', If(today ()- (INV_DATE+90) <= 90, 'FOUR', 'REST')))));
elseif
CUSTOMER=54 then
if(today() -[Deli_Date] <= 0 ,'ONE', if(today() -[ Deli_Date] <= 30 ,'TWO', if(today () -[ Deli_Date] <= 60,'THREE', If(today ()- [Deli_Date] <= 90,
'FOUR', 'REST'))));
else
if(today() -[Date] <= 0 ,'ONE', if(today() -[Date] <= 30 ,'TWO', if(today () -[Date] <= 60,'THREE', If(today ()- [Date] <= 90, 'FOUR', 'REST'))))) as [Aged];
endif
Regards
Joe
Hi Joe,
Try This Code:
If(CUSTOMER=400,
if(today() -(INV_DATE+90) <= 0,'ONE',
if(today() -(INV_DATE+90) <= 30,'TWO',
if(today () -(INV_DATE+90) <= 60,'THREE',
If(today ()- (INV_DATE+90) <= 90, 'FOUR', 'REST')))),
If(CUSTOMER=54,
if(today() -[Deli_Date] <= 0 ,'ONE',
if(today() -[ Deli_Date] <= 30 ,'TWO',
if(today () -[ Deli_Date] <= 60,'THREE',
If(today ()- [Deli_Date] <= 90,'FOUR', 'REST')))),
If(today() -[Date] <= 0 ,'ONE',
if(today() -[Date] <= 30 ,'TWO',
if(today () -[Date] <= 60,'THREE',
If(today ()- [Date] <= 90, 'FOUR', 'REST')))))) as [Aged]
Hi Joe,
Try This Code:
If(CUSTOMER=400,
if(today() -(INV_DATE+90) <= 0,'ONE',
if(today() -(INV_DATE+90) <= 30,'TWO',
if(today () -(INV_DATE+90) <= 60,'THREE',
If(today ()- (INV_DATE+90) <= 90, 'FOUR', 'REST')))),
If(CUSTOMER=54,
if(today() -[Deli_Date] <= 0 ,'ONE',
if(today() -[ Deli_Date] <= 30 ,'TWO',
if(today () -[ Deli_Date] <= 60,'THREE',
If(today ()- [Deli_Date] <= 90,'FOUR', 'REST')))),
If(today() -[Date] <= 0 ,'ONE',
if(today() -[Date] <= 30 ,'TWO',
if(today () -[Date] <= 60,'THREE',
If(today ()- [Date] <= 90, 'FOUR', 'REST')))))) as [Aged]
Dear Vijay,
Excellent,
it works, can you advise me where I made the mistake because I read the document and I tried.
Thanks a lot......
Joe
Hey Joe,
Qlikview does not support If ...Then ...Else. Here everything can be achieved by using Comma.
Also most imortent is how you place parenthesis. Once you go through the code you will understand.
Rehards
Vijay
QlikView does indeed support IF ... THEN ... ELSE. But that is a control statement and should be used "outside" the Load-statement.
But in this case you need the if-function: if(<condition>, <value_for_true>, <value_for_false>) inside the Load statement. Which is exactly what Vijay indicates in his answer.
/HIC