Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Specialist II
Specialist II

Re: Sum function in load script

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

Highlighted
Employee
Employee

Re: Sum function in load script

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

Highlighted
MVP & Luminary
MVP & Luminary

Re: Sum function in load script

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.

Highlighted
Partner
Partner

Re: Sum function in load script

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

Highlighted
Master III
Master III

Re: Sum function in load script

Try

Load

[Product Code],

Sum(Quantity) AS All_Qty

Resident OpportunityWon

where IsPrimary__c = 1 AND [Close Date] > 42552

Group by [Product Code]

Highlighted
Creator III
Creator III

Re: Sum function in load script

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];