Thanks Zhouyi Zhang for the help, it's nice and clear method but somehow it doesn't work with my actual data, I perhaps over-simplifed the example.
In my real data:
- someone might perform the action multiple times in particular time period, but I am only interested in the first instance (each event is timestamped so I can pick out the first occurrence);
- there are events 3 and 4 etc. as well.
In my real data the actual resultant sum from the third calc is always >1 even if one of the actions is null - I think this is because multiple occurrences of the one event (and events which are not the wanted second event) are being counted.
I'll keep playing