dbTalk Databases Forums  

Running Sum (opposite)

comp.databases.ms-access comp.databases.ms-access


Discuss Running Sum (opposite) in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
koturtle
 
Posts: n/a

Default Running Sum (opposite) - 04-08-2010 , 09:57 AM






I need to have a query that does the opposite of a running sum. I
would like to show a totals column that actually decreases with each
record. The first record would need to be the total of a field and it
would decrease as events happen (expire). The result of the query
will help me create a burn down chart.

Any ideas?

Thanks

KO

Reply With Quote
  #2  
Old   
Marco Pagliero
 
Posts: n/a

Default Re: Running Sum (opposite) - 04-08-2010 , 12:17 PM






On 8 Apr., 16:57, koturtle <kol... (AT) gmail (DOT) com> wrote:
Quote:
I need to have a query that does the opposite of a running sum. *I
would like to show a totals column that actually decreases with each
record. *The first record would need to be the total of a field and it
would decrease as events happen (expire). *The result of the query
will help me create a burn down chart.
This is not easy to do in a query, as no real record can have the sum
of all records and it is difficult to tell one record which records in
the list are before itself. But if you know how to make a running sum
in a report, you just have to subtract the individual running sums
from the total, I think.

Anyway, let say the records have some field "Value" and are sorted
after some field "Sort"

select value, sort, dSum("[Value]", "Table") -
nz(dSum("[Value]","Table", "[Sort]<" & [Sort])) as NotRunSum from
Table order by [Sort]

Not tested

Greetings
Marco P

Reply With Quote
  #3  
Old   
Salad
 
Posts: n/a

Default Re: Running Sum (opposite) - 04-08-2010 , 12:40 PM



koturtle wrote:
Quote:
I need to have a query that does the opposite of a running sum. I
would like to show a totals column that actually decreases with each
record. The first record would need to be the total of a field and it
would decrease as events happen (expire). The result of the query
will help me create a burn down chart.

Any ideas?

Thanks

KO
Let's say you had an ID field and 10 records in the table; ID 1..10. And
you have a field called Money.
MoneySum : dsum("Money","MoneyTable","ID <= " & [ID])

That will create a column called MoneySum in your query.

You could create another column
MoneyTotalSum : dsum("Money","MoneyTable")

You could then create a third column
MoneyRunningSum : [MoneyTotalSum] - [MoneySum]

I'd do something different if a form or report.

Reply With Quote
  #4  
Old   
koturtle
 
Posts: n/a

Default Re: Running Sum (opposite) - 04-08-2010 , 01:23 PM



On Apr 8, 10:40*am, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
Quote:
koturtle wrote:
I need to have a query that does the opposite of a running sum. *I
would like to show a totals column that actually decreases with each
record. *The first record would need to be the total of a field and it
would decrease as events happen (expire). *The result of the query
will help me create a burn down chart.

Any ideas?

Thanks

KO

Let's say you had an ID field and 10 records in the table; ID 1..10. And
you have a field called Money.
* * * * MoneySum : dsum("Money","MoneyTable","ID <= " & [ID])

That will create a column called MoneySum in your query.

You could create another column
* * * * MoneyTotalSum : dsum("Money","MoneyTable")

You could then create a third column
* * * * MoneyRunningSum : [MoneyTotalSum] - [MoneySum]

I'd do something different if a form or report.
Thank You, Thank You!!!!

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.