Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
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
Not applicable

Re: Sum function in load script

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

Damian_Waldron
Not applicable

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.

jagan
Not applicable

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.

shraddha_g
Not applicable

Re: Sum function in load script

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

sasiparupudi1
Not applicable

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]

Silambarasan1306
Not applicable

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