Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
nigel987
Creator II
Creator II

Load Statement with calculated fields

Hi,

just a general question. I'm looking for a best practice. Is it better to seperate the Load Statement and calculated fields in terms of performance? For example, should I rather write:

Table:

Load Field A,

        Field B,

        Sum(Field B) AS Sales

From ...

or is it better to seperate this into:

Table:

Load Field A,

        Field B

From ...


Temp*

Load *,

      Sum(Field B) AS Sales

Resident Table;


Drop Table;


Thanks for any reply

1 Solution

Accepted Solutions
marcus_sommer

I think there couldn't be a general answer - it will always depend on the concrete scenario if an aggregation on the script-level is more suitable then doing this within the gui and if a script-solution is needed how the real requirements are.

For example, by a small dataset you don't need to worry much about performance but already by mid-sized datasets it will make a difference if you need to include all fields with an anggregartion and/or if there needs to filter something with a where-clause - this meant the combination of where- and group by statements within a single load could be significant slower then separating them.

Therefore it will be depend ...

- Marcus

View solution in original post

5 Replies
robert_mika
Master III
Master III

when using aggr function (SUM,MAX,COUNT..) you will need to use Group By a statement as well.

Load

       Field A,

        Field B,

       Sum(Field B) AS Sales

From ...

group by Field A,Field B


Then you will need to map this back to your final table.

so is better to load once a whole table and then perform your calculations.

MayilVahanan

Hi

You don't want to split the tables.

Table:

Load Field A,

        Sum(Field B) AS Sales

From your TableName

Group by Field A;

Hope, you don't want Field B.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
vinieme12
Champion III
Champion III

When Using Calculations in your table load, imagine working with a pivot table!

You will need to include only those fields for which you want your measure to be aggregated by.

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

  1. The Pivot or Straight tables are more dynamic and flexible than defining all your measures in the script.
  2. Also, the applications respond time is perfect when expressions in front end are used with care. While loading time will increase when doing aggregations in script.
marcus_sommer

I think there couldn't be a general answer - it will always depend on the concrete scenario if an aggregation on the script-level is more suitable then doing this within the gui and if a script-solution is needed how the real requirements are.

For example, by a small dataset you don't need to worry much about performance but already by mid-sized datasets it will make a difference if you need to include all fields with an anggregartion and/or if there needs to filter something with a where-clause - this meant the combination of where- and group by statements within a single load could be significant slower then separating them.

Therefore it will be depend ...

- Marcus