Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Hi Everyone Can we use sum function on script level i.e at the time of loading

Hi Everyone

Can we use sum function on script level i.e at the time of loading?

4 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi Kumar,

You can use Sum(), Max(),...aggregate functions in script, but you need to group the dimensions.  Check below example

LOAD

     Dim1,

     Dim2,

     Sum(Dim3) AS Sales

FROM DataSource

GROUP BY Dim1, Dim2;

Note:The fields specified in Load statement must contain in Group by, otherwise you will get error.

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

what about Dim3 ,should it also be in Group By ?

jagan
Luminary Alumni
Luminary Alumni

Hi,

The dimensions which are using in Aggregate functions like Sum() need not to be in Group by.

Regards,

Jagan.

Not applicable
Author

Hi

see this script

b:

load * inline [

invoiceno,amount,city

1,100,a

2,100,a

3,100,b

4,200,c

5,200,e

6,300,f

2,300,a

];

LOAD invoiceno,Sum(amount) as newamount Resident b Group by invoiceno ;