Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Data manipulation during load

Hi there,

I need to do some data manipulation during the loading procedure and do not quite know how. I have a table such as the below

   

CustomerIdSalesAggregated_Sales%
1106016.67%
1206033.33%
1306050.00%
251338.46%
281361.54%
32121100.00%

How can I calculate the Aggregated_Sales entries during the load procedure when given the CustomerId and Sales data?

Thanks a lot for your help,

Florian

3 Replies
marcus_sommer

Maybe in this way:

table1:

load CustomerId, Sales from YourTable;

     left join

Load CustomerId, sum(Sales) as Aggregated_Sales resident table1 group by CustomerId;

table2:

load *, Sales / Aggregated_Sales as % resident table1;

drop tables table1;

- Marcus

sunny_talwar

You don't have to do this in the script, you can come up with this on the front end if you want using this expression

Sum(TOTAL <CustomerId> Sales)

but for doing this in the script, you can do like this

Table:

LOAD CustomerId,

          Sales

FROM....

Left Join (Table)

LOAD CustomerId,

          Sum(Sales) as Aggregated_Sales

Resident Table

Group By CustomerId;

maxgro
MVP
MVP

you can use the total in the user interface (chart)

for aggregated sales (by customer)

Sum(total <CustomerId> Sales)

and for %

Sum(Sales) / Sum(total <CustomerId> Sales)