Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'd like to accumulate date during the reload do you have a sample script for this ?
thanks in advanced.
David
To aggregate data in the load there are several ways. With each method the key points are a the aggregator - obviously (sum(Sales), count(Customers)) and the group you want to aggregate across.
The most simple way to begin with script aggregation is to take a simple dataset: let's say daily sales - multiple products and product groups sold over different days. A natural requirement would be to aggregate the daily sales:
Load the dataset as normal then perform a resident load against it with the aggregation expression (sum(Sales))and the Date after the Resident simply add a Group By clause:
DailySales:
Load only(Date),
Sum(Sales)
Resident SalesData Group By Date;
That should do it.
You can also do the resident load and then left join back to the original data.
Hope that helps,
Matt - Visual Analytics Ltd
Can you post limited data in Excel and what types of accumulation of you want ?.
This example shows how to calculate a running total (a type of accumulation) in the load script.
Thanks for your help !
David
Dear David,
can you tell me on which dimention you want to accumulate data?. Because in different different scenario we use different method of accumulation.
Regards
Sunil
hi Sunil,
see an example of the data:
Date | installs | accumulated |
01/01/2011 | 5 | 5 |
02/01/2011 | 4 | 9 |
03/01/2011 | 2 | 11 |
04/01/2011 | 3 | 14 |
05/01/2011 | 2 | 16 |
06/01/2011 | 1 | 17 |
07/01/2011 | 8 | 25 |
08/01/2011 | 5 | 30 |
09/01/2011 | 3 | 33 |
I need to creat a new field 'accumulated' (during the reload).
best
David
Should work as fllws:
Data:
LOAD
Date,
NUMSUM(installs, PEEK('installs', -1)) AS installs;
LOAD * INLINE [Date , installs , accumulated
01/01/2011 , 5 , 5
02/01/2011 , 4 , 9
03/01/2011 , 2 , 11
04/01/2011 , 3 , 14
05/01/2011 , 2 , 16
06/01/2011 , 1 , 17
07/01/2011 , 8 , 25
08/01/2011 , 5 , 30
09/01/2011 , 3 , 33];
HTH
Peter
Dear David,
peter's suggestion is perfect and if you any query reply.
Seems David just flied to NASA with the solution provided by PETERE. He should have marked this thread answered. Awesome Peter.