Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

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

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

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.

Highlighted
Not applicable

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

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

Highlighted
MVP & Luminary
MVP & Luminary

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

Hi,

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

Regards,

Jagan.

Highlighted
Not applicable

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

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 ;