Re: Conditional Running Sum
am 31.03.2008 07:55:30 von savas_karadumanHello Arch,
You are right that i did a mistake in the first line.
your statement CORRECT!
Finish date?>
Regardless how i define "between"-including or does not including
Start Date-, i can not get proper output.
May be i could not describe my problem well to you.
If you are interested, i am posting variations below with its output:
Variation1:
SELECT Query1.SortedDate, DSum("Money","Query1","[SortedDate] >= #" &
[Start] & "#" And "[SortedDate] < #" & [Finish] & "#") AS RunningMoney
FROM Query1
ORDER BY Query1.SortedDate;
***
Output for Variations1:
SortedDate RunningMoney
01/01/2008 13
02/01/2008 13
03/01/2008 13
04/01/2008 13
05/01/2008 13
Variation2: /Query maker approach
SELECT Query1.SortedDate, (SELECT Sum([Money])
FROM [Query1] AS [qry_1] WHERE [qry_1].[SortedDate]>=
[Query1].[Start] AND [qry_1].[SortedDate]<[Query1].[Finish]) AS
RunningMoney
FROM Query1
ORDER BY Query1.SortedDate;
***
Output for Variations2:
SortedDate RunningMoney
01/01/2008 10
02/01/2008 NULL
03/01/2008 12
04/01/2008 3
05/01/2008 NULL