Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load a field as a sum of values

Hi,

I would like to have a table like the right side of the image from the one at the left.

I have no problem with 'BRUTO' using

load distinct(LOCATA),

BRUTO

...

but I do not know how import AVIONPRR as a sum of AVIONPRR, I suppose it exist a funtion but I do not know which.

Help please.

Thanks

01-05-2013 20-24-39.png

1 Solution

Accepted Solutions
ryanhicks
Contributor III
Contributor III

To do this in the load you need to sum your values using a group by statement.

Load LOCDATA,

BRUTO,

Sum(AVIONPRR) as AVIONPRR_TOTAL

from  DataSource.qvd

group by LOCDATA,

BRUTO;

This will load your data grouped by LOCDATA and BRUTO, and it will sum you AVIONPRR field based on the combination of LOCDATA and BRUTO. 

This should give you the results that you are looking for based on your post.

View solution in original post

5 Replies
nilesh_gangurde
Partner - Specialist
Partner - Specialist

Hiiii,

load the data into Qlikview and then add LOCATA as Dimension and  two expressions

1.   Sum(BRUTO)

2.   SUM(AVIONPR)

-NILESH

Not applicable
Author

Thanks but I need to do it in the script, I need a table.

nilesh_gangurde
Partner - Specialist
Partner - Specialist

If you need to do this in the Script then use the following script at load time.

Table1:

Load

LOCATA,

SUM(BRUTO) as BRUTO

FROM

FileSource group by LOCATA;

Table2:

Load

LOCATA,

SUM(AVIONPR) as AVIONPR

FROM

FileSource group by AVIONPR;

The two tables will create and automatically gets joined to show the values at frontend.

-Nilesh



ryanhicks
Contributor III
Contributor III

To do this in the load you need to sum your values using a group by statement.

Load LOCDATA,

BRUTO,

Sum(AVIONPRR) as AVIONPRR_TOTAL

from  DataSource.qvd

group by LOCDATA,

BRUTO;

This will load your data grouped by LOCDATA and BRUTO, and it will sum you AVIONPRR field based on the combination of LOCDATA and BRUTO. 

This should give you the results that you are looking for based on your post.

Not applicable
Author

Perfect, thank you.