Displaying 1 result from an estimated 1 matches for "purchase_amount".
2011 Mar 09
2
Differences per group
...chase amount, what
I would like to do is to show the difference between amount purchased
compared to the month before per customer. 
I have made some attempts myself using diff, but what i can not get to work
is that each different customer starts with a 0.
This is an example of what I have:
>purchase_amount
customer	amount
123		6	
123		5
123		9
123		8
123		11
123		7
230		19
230		18
230		12
230		17
380		7
380		9	
380		2	
380		7
380		8
380		8	
380		6
380		8
How I would like it to look like:
customer	amount	difference
123		6		0	
123		5		-1
123		9		4
123		8		-1
123		11		3
123		7		-4
230		19		0
230		18...