Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

nevilledhamsiri
Valued Contributor

Nested If statement in the script

As per the script given below, I need to fix the date join once following conditions are satisfied

**MonthjoinTemp<>currentMonth

**For currentMonth , paid needs to be zero of the employee.

Can you please combined both in a if statement?.

Thanks 

Neville

 

LOAD BR_Code, Month,MONTH(Month)as tr_month,YEAR(Month) as TR_YEAR,EPF_NO,Repeat('0', 6-len(EPF_NO))& EPF_NO as EPF,

EMP_NO,Repeat('0',6-LEN(EMP_NO))&EMP_NO AS EMP ,[Employee_ Name], PAID
FROM [D:\PAY_SUMMERIES.xlsx] (ooxml, embedded labels, table is Sheet3);


left join (Sheet3)
load 1 as monthLeftFlag,
date(max(Month)) as MonthLeftTemp ,
date(Min(Month)) as MonthjoinTemp,
EMP_NO
Resident Sheet3
Group By EMP_NO;
Left Join(Sheet3)
LOad date(max(Month)) as currentMonth
Resident Sheet3;

Data:
load *,
if(MonthLeftTemp=currentMonth,'Active','Left') as EMP_STATUS,
if(MonthLeftTemp<>currentMonth,MonthLeftTemp) as MonthLeft,
if(MonthjoinTemp<>currentMonth,MonthjoinTemp)as MonthJoin
Resident Sheet3;

drop Table Sheet3;

 

6 Replies
Highlighted
nevilledhamsiri
Valued Contributor

Re: Nested If statement in the script

Can some one help me on this

deshikas
New Contributor III

Re: Nested If statement in the script

Try this.

If (MonthjoinTemp<>currentMonth, 'Not Current',
 If (MonthjoinTemp =currentMonth,0,  'MonthJoned'))

nevilledhamsiri
Valued Contributor

Re: Nested If statement in the script

seems to be not working

 

deshikas
New Contributor III

Re: Nested If statement in the script

Load *,
if (Month = currentMonth, 0, PAID) as PAID2
Resident Data;

Support
Support

Re: Nested If statement in the script

Neville, did Desh's last post get things working?  If so, please use the Accept as Solution button on that post to mark that as the soluiton and give Desh credit for the help provided.  If you figured out something else, consider posting that and mark it, and if you are still working on things, leave an update on where things are.

Regards,
Brett

To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.
nevilledhamsiri
Valued Contributor

Re: Nested If statement in the script

Deshikas

It doesn't make what I need to achieve. Could you please send me your out put  to see what you have got is something  help me in some way.

Thanks for your help