Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
bawilson485
New Contributor II

Replacing Aggr function with similar function in load script

I have a sheet that shows all customers who have bought an item for the first time in the last year.  It also calculates all items that have been sold for the first time in the last year.  It does this by using an aggr(min(docdate), Brand) function for the brands and an aggr(min(docdate), ItemCode) function for the items.  The formulas work, but the problem is that the sheet tends to crash.  I figure it is because the processing power required by running these functions during use of the app is too high, so i figured it would be better to just go ahead and create tables with only the SKUs and Brands that have been invoiced in the last 12 months in the load script instead of virtually using the aggr function.


I have seen help pages suggesting the use of the group by function, but they also state that the fields must reside in the same table.  Item Code and Brand are in one table and DocDate is in another, so that would not work.  Can Group By work here?  If not, is there a workaround or different function that i could use to achieve the same result?

Thank you

1 Solution

Accepted Solutions
OmarBenSalem
Esteemed Contributor

Re: Replacing Aggr function with similar function in load script

maybe sthing like this?

table1:

DocDate,

id,

...

left join(table1)

table2:

Brand,

"Item Code"..

with that will have a single table containing the fields.

you can know do this :

newTable:

load

min(DocDate) as minDate,

Brand,

"Item Code"

resident table1

group by

Brand,

"Item Code";

drop fields

Brand,

"Item Code" from table table1;

hope this helps

2 Replies
OmarBenSalem
Esteemed Contributor

Re: Replacing Aggr function with similar function in load script

maybe sthing like this?

table1:

DocDate,

id,

...

left join(table1)

table2:

Brand,

"Item Code"..

with that will have a single table containing the fields.

you can know do this :

newTable:

load

min(DocDate) as minDate,

Brand,

"Item Code"

resident table1

group by

Brand,

"Item Code";

drop fields

Brand,

"Item Code" from table table1;

hope this helps

bawilson485
New Contributor II

Re: Replacing Aggr function with similar function in load script

A slightly modified version of this seems to work.  Thank you.