Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
nevilledhamsiri
Specialist
Specialist

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
nevilledhamsiri
Specialist
Specialist
Author

Can some one help me on this

deshikas
Contributor III
Contributor III

Try this.

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

nevilledhamsiri
Specialist
Specialist
Author

seems to be not working

 

deshikas
Contributor III
Contributor III

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

Brett_Bleess
Former Employee
Former Employee

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 do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
nevilledhamsiri
Specialist
Specialist
Author

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