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

Syntax Error in Expression

Hello All,

LOAD application_no,

     paycode as %PAYCODE_Emp,

     request_id,

//     request_date,

     leave_from,

     year(leave_from) as LeaveYear,

     month(leave_from) as LeaveMonth,

     day(leave_from) as LeaveDay,

     leave_to,

     //leave_to,

     leavecode as LEAVECODE,

     halfday,

     leavedays,

     userremarks,

//     Stage1_approved,

//     Stage1_approval_id,

//     Stage1_approval_date,

//     Stage1_approval_Remarks,

//     Stage2_approved,

//     Stage2_approval_id,

//     Stage2_approval_date,

//     Stage2_Approval_Remarks,

//     hod_remarks,

     chklbl1

//     voucherno

//     Stage3_approved,

//     Stage3_approval_id,

//     Stage3_approval_date,

//     Stage3_approval_Remarks,

//     LWPbal,

//     IsArrear,

//     BVRLeave

FROM

$(Vrawqvdspath)\LeaveRequest.qvd

(qvd);

Temp:

load

    LeaveMonth,

    if(LEAVECODE='CL', sum(leavedays)) as NoOfCLDays

    Resident LeaveLedger Group by LeaveMonth;


Can somebody tell me why their is an error in this resident. It is showing "invalid expression error".


Regards,

Balraj


1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Try

Temp:

load

    LeaveMonth,

    if(LEAVECODE='CL', sum(leavedays)) as NoOfCLDays

Resident LeaveLedger

Group by LeaveMonth, LEAVECODE;

View solution in original post

5 Replies
MK_QSL
MVP
MVP

Try

Temp:

load

    LeaveMonth,

    if(LEAVECODE='CL', sum(leavedays)) as NoOfCLDays

Resident LeaveLedger

Group by LeaveMonth, LEAVECODE;

tresesco
MVP
MVP

Or, probably you need Sum(If.., rather than If(Sum(.... Try like:

Temp:

load

    LeaveMonth,

    Sum(if(LEAVECODE='CL', leavedays)) as NoOfCLDays

Resident LeaveLedger

Group by LeaveMonth;

its_anandrjs

Try your Temp table with different ways

Temp:

load

    LeaveMonth,

   Sum( if(LEAVECODE='CL', leavedays) ) as NoOfCLDays //If inside the SUM aggregation function.

   Resident LeaveLedger Group by LeaveMonth;

Not applicable
Author

try this place table name as LeaveLedger and then you can use table name in resident lode and also check if condition wrong if(LEAVECODE='CL', sum(leavedays),else part you need to place.

check code below

LeaveLedger:

LOAD application_no,

     paycode as %PAYCODE_Emp,

     request_id,

//     request_date,

     leave_from,

     year(leave_from) as LeaveYear,

     month(leave_from) as LeaveMonth,

     day(leave_from) as LeaveDay,

     leave_to,

     //leave_to,

     leavecode as LEAVECODE,

     halfday,

     leavedays,

     userremarks,

//     Stage1_approved,

//     Stage1_approval_id,

//     Stage1_approval_date,

//     Stage1_approval_Remarks,

//     Stage2_approved,

//     Stage2_approval_id,

//     Stage2_approval_date,

//     Stage2_Approval_Remarks,

//     hod_remarks,

     chklbl1

//     voucherno

//     Stage3_approved,

//     Stage3_approval_id,

//     Stage3_approval_date,

//     Stage3_approval_Remarks,

//     LWPbal,

//     IsArrear,

//     BVRLeave

FROM

$(Vrawqvdspath)\LeaveRequest.qvd

(qvd);

Temp:

load

    LeaveMonth,

    if(LEAVECODE='CL', sum(leavedays),0) as NoOfCLDays

    Resident LeaveLedger

Group by LeaveMonth;

Anonymous
Not applicable
Author

Manish,

I am working on this KPI, Could you help me to get it?

LeaveLedger:

LOAD PAYCODE as %PAYCODE_Emp,

L01_ADD as Total_CL(predefined total leaves),

L02_ADD as Total_SL,

L03_ADD as Total_EL

FROM

$(Vrawqvdspath)\LeaveLedger.qvd

(qvd);

left join

LOAD application_no,

     paycode as %PAYCODE_Emp,

     request_id,

//     request_date,

     leave_from,

     year(leave_from) as LeaveYear,

     month(leave_from) as LeaveMonth,

     day(leave_from) as LeaveDay,

     leave_to,

     //leave_to,

     leavecode as LEAVECODE,

     halfday,

     leavedays(holds interger values)

FROM

$(Vrawqvdspath)\LeaveRequest.qvd

(qvd);

Need To Achieve:

@Emp_NameLeaveMonthLeaveDayLEAVECODEAccumulated Casual LeaveAccumulated Earned LeaveAccumulated Sick LeaveCL AccruedEL AccruedSLAccruedClosing CL BalanceClosing EL BalanceClosing SL Balance
XXXMay9SL10.510700210.5105
XXXJun18SL10.510500110.5104
XXXJul1CL10.51041009.5104
XXXJul10OD9.51040009.5104
XXXJul11CL9.51041008.5104
XXXJul12OD8.51040008.5104
XXXAug25COF8.51040008.5104
XXXAug26COF8.51040008.5104

Let me know if you need any other info?

Regards,

Balraj