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

Syntax in expression error: Resident and Preceding load

Hi,

Im trying to fetch ID, Barcode1, Barcode2,Units1, Units2 from Table1 and do the following operation.

But getting the error: "Syntax error in Expression"

Please lemme knw if there is any mistake i'm doing!

Load ID, B1, B2, Sum(U1) as FirstSum, Sum(U2) as SecondSum

Group By SKU#;

Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2

Resident

Table1;

1 Solution

Accepted Solutions
prabhu0505
Specialist
Specialist

Try this:

Load ID, B1, B2, Sum(U1) as FirstSum, Sum(U2) as SecondSum

Group By ID, B1, B2;  // Group by should have all non agreegated fields

Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2

Resident

Table1;

View solution in original post

5 Replies
swuehl
MVP
MVP

Your aggregation field in the GROUP BY clause is SKU# and no other fields than the aggregation fields may be used outside aggregation functions in the loaded expressions. Hence you'll either need to add ID, B1, B2 to the aggregation fields in the clause or embed these in aggregation functions.

prabhu0505
Specialist
Specialist

Try this:

Load ID, B1, B2, Sum(U1) as FirstSum, Sum(U2) as SecondSum

Group By ID, B1, B2;  // Group by should have all non agreegated fields

Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2

Resident

Table1;

Not applicable

In your script SKU# is not present in the table 1. If you have that in your actual table and you want to group by values over it, then use appropriate aggregation function for ID, B1 and B2 also (If it make sense :-)). Something similar to below

Load

SKU#,

Min(ID) as ID

,Min(B1) as B1

,Min(B2) as B2

,Sum(U1) as FirstSum,

Sum(U2) as SecondSum

Group By SKU#;

Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2, SKU#

Resident

Table1;

Regards,

KKR

markgraham123
Specialist
Specialist
Author

Hi Saravana,

Got it.

thanq very much.

markgraham123
Specialist
Specialist
Author

Hi Kranthi,

Sorry for the mistake.

It was Group by ID;