spss-modeler

Aggregate the columns based on a condition in SPSS modeler


I would like to add the values based on a column:

For example: The input table looks like this:

USERS   Order_date    Number_of_orders
alice   01-01-2014          2
alice   19-01-2014          5
alice   20-05-2014          8
bob     03-01-2014          1
bob     08-04-2014          9

The output should be like:

USERS   Order_date    Number_of_orders(NEW)
alice   01-01-2014          2
alice   19-01-2014          7
alice   20-05-2014          15
bob     03-01-2014          1
bob     08-04-2014          10

Number_of_orders(NEW) is the sum of total orders in the same day + the total number of previous orders of that user. Please let me know how to do this with SPSS modeler.


Solution

  • I know this is fairly late but what I would do is:

    1) create a conditional derive node if NAME /= @OFFSET(NAME,1) or @NULL(NAME) then Number_of_orders else null

    2) create filler node if @NULL(Derive325) then @OFFSET(Derive325,1)+Number_of_orders

    Just FYI, if I were to look for this, I would use the word cumulative, not aggregate