Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum function in load script

Hi All,

I am trying to use a Sum function in load script where I want to sum the quantity by Product Code (Quantity and Product Code are two fields) and couple of other conditions as in where clause in syntax below.  I used Group by Product Code.  I get an error below:

I really appreciate any help on this

Thanks

Monica

The following error occurred:

Invalid expression

The error occurred here:

Composite: NoConcatenate Load *, Sum(Quantity) AS All_Qty Resident OpportunityWon where IsPrimary__c = 1 AND [Close Date] > 42552 Group by [Product Code]

Composite:

NoConcatenate

Load *,

Sum(Quantity) AS All_Qty

Resident OpportunityWon

where IsPrimary__c = 1 AND [Close Date] > 42552

Group by [Product Code];

6 Replies
lakshmikandh
Specialist II
Specialist II

Not Sure about this, Try mentioning column names instead of "*"

Anonymous
Not applicable
Author

the '*' is the problem. You either need to group by all these fields individually or remove from the script.

jagan
Partner - Champion III
Partner - Champion III

Hi,

You need to define all individual columns in Group by.  Remove * and list all the columns required and specify the same in GROUP BY Clause.

Composite:

NoConcatenate

Load

[Product Code],

Colum2,

Column3,

Sum(Quantity) AS All_Qty

Resident OpportunityWon

where IsPrimary__c = 1 AND [Close Date] > 42552

Group by [Product Code],

Column2,

Column3;

Hope this helps you.

Regards,

Jagan.

shraddha_g
Partner - Master III
Partner - Master III

Instead of load * , mention all field names and include all those fields in group by

sasiparupudi1
Master III
Master III

Try

Load

[Product Code],

Sum(Quantity) AS All_Qty

Resident OpportunityWon

where IsPrimary__c = 1 AND [Close Date] > 42552

Group by [Product Code]

Silambarasan1306
Creator III
Creator III

Hi mchhabra


        '*' is the problem. You need to group by all these fields individually or remove other fields from the script

or Else

Try this,

Load

[Product Code],

Sum(Quantity) AS All_Qty

Resident OpportunityWon

where IsPrimary__c = 1 AND [Close Date] > 42552

Group by [Product Code];