Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to write Sum(columnname) in load statement

Hi,

Could anyone help me how to write Sum(Amount) in Load statement instead of Expression in pivot table.

Thanks.

4 Replies
Clever_Anjos
Employee
Employee

A sum into script must include a group by clause

LOAD

    ID,

   sum(Amount) as Amount_sum

FROM

[your Qvd]

Group by ID;

jonathandienst
Partner - Champion III
Partner - Champion III

Amelia

Just like that. For example:

     LOAD AccountID,

          Sum(Amount) As Amount

     Resident Accounts

     Group By AccountID

All non-aggregated fields (AccountID in this example)  should be in a Group By clause.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
pgrenier
Partner - Creator III
Partner - Creator III

Hello Amelia,

The Sum() function aggregates your data according to a group of fields. So let's say you would like to summarize the total sales of a product per month, your load statement would look something like this:

MonthlySales:

LOAD MonthStart(OrderDate) as OrderMonth

   , Product

   , Sum(Amount) as MonthlySales

Group By MonthStart(OrderDate), Product;

LOAD OrderDate

   , Product

   , Amount

From ...

Regards,

Philippe

Not applicable
Author

Thanks and I used same but it's getting

Error: Invalid Expression while reloading
Could you help how to solve this.