Dear Experts,
I have 3 tables:
"Dim_Date"
Date_ID
MonthNumber (Month nr... ex. jan=1)
Year (ex. Year=2007)
Year&Month (Contains both year and name of month... ex. "2007 - July")
"Customer"
Customer_ID
CustomerNumber (Contains a customernr... ex. "08243")
CustomerName (Contains the Customers name... ex. "Barneys Carwash")
"Customer_Entry"
Entry_Date_ID
Customer_ID
OriginalAmount (Contains the amount)
What I am looking for is to get the running sum (OriginalAmount) for each month...
lets say the "Customer_Entry" tables contains the following:
Entry_Date_ID Customer_ID OriginalAmount
1 33 150
2 33 100
2 33 50
3 33 200
4 33 300
4 33 200
6 65 120
6 65 140
7 65 170
Then my goal is to get the following output, for a customer with a certain CustomerNumber (not ID):
CustomerName Year&Month RunningSum
Mortens Bilvask 2007 - Jan 150
Mortens Bilvask 2007 - Feb 300 (150 + 100 + 50)
Mortens Bilvask 2007 - Mar 500 (150 + 100 + 50 + 200)
Mortens Bilvask 2007 - Apr 1000 (150 + 100 + 50 + 200 + 300 + 200)
When I did my own attemps I was using a subquery. But I keep getting dobble posts because there are more than 1 amount for 1 Entry_Date_ID.
I hope one of you can come up with a solution?
Regards Mzane
I have 3 tables:
"Dim_Date"
Date_ID
MonthNumber (Month nr... ex. jan=1)
Year (ex. Year=2007)
Year&Month (Contains both year and name of month... ex. "2007 - July")
"Customer"
Customer_ID
CustomerNumber (Contains a customernr... ex. "08243")
CustomerName (Contains the Customers name... ex. "Barneys Carwash")
"Customer_Entry"
Entry_Date_ID
Customer_ID
OriginalAmount (Contains the amount)
What I am looking for is to get the running sum (OriginalAmount) for each month...
lets say the "Customer_Entry" tables contains the following:
Entry_Date_ID Customer_ID OriginalAmount
1 33 150
2 33 100
2 33 50
3 33 200
4 33 300
4 33 200
6 65 120
6 65 140
7 65 170
Then my goal is to get the following output, for a customer with a certain CustomerNumber (not ID):
CustomerName Year&Month RunningSum
Mortens Bilvask 2007 - Jan 150
Mortens Bilvask 2007 - Feb 300 (150 + 100 + 50)
Mortens Bilvask 2007 - Mar 500 (150 + 100 + 50 + 200)
Mortens Bilvask 2007 - Apr 1000 (150 + 100 + 50 + 200 + 300 + 200)
When I did my own attemps I was using a subquery. But I keep getting dobble posts because there are more than 1 amount for 1 Entry_Date_ID.
I hope one of you can come up with a solution?
Regards Mzane