running sum that knows about previous rows

smile

Registered User.
Local time
Yesterday, 22:04
Joined
Apr 21, 2006
Messages
212
Hi, I'm trying to make a running sum on a report that knows about previous rows.

For example if I have a long list a few months of data, if I filter to show only the current month it needs to start from first record to the current month, not from zero.

I tried Running Sum property of a calculated control on a Report and it works fine but if I filter the list the running sum starts at 1st record value, from zero.
 
I believe Adam (ajetrumpet) just posted a FAQ or sample that shows how to do this.
 
Use a parameterised Totals query that calculates the total to the day before the date you want the Report to run from, then use DLookup on the query to bring the value into the Report header. You can then use that as a start figure
 
Use a parameterised Totals query that calculates the total to the day before the date you want the Report to run from, then use DLookup on the query to bring the value into the Report header. You can then use that as a start figure

Well, I created query that gets data form my table and limited criteria like this:

<[forms]![daterange].[startdate]

I selected to sum the field that contains the money amount.

Then I used another query that sums up the money field from previous query.

Do you mean I should not use cascading queries?
 
My problem is that one of fields that must be added to get total sum for a month is from another table. So in the first query I have 2 tables and relationship. I have this a field as expression and this the code for the expresion.

PHP:
Kaina su PVM: Sum(IIf([tbl_pagrindinis]!PVM=True;[tbl_pagrindinis]!Kiekis*[tbl_pagrindinis]![Kaina be PVM]*0,18+[tbl_pagrindinis]![Kaina be PVM]*[tbl_pagrindinis]!Kiekis;[tbl_pagrindinis]!Kiekis*[tbl_pagrindinis]![Kaina be PVM]*0+[tbl_pagrindinis]![Kaina be PVM]*[tbl_pagrindinis]!Kiekis))

How can I have this totaled without using cascading queries?

Tried Expr1: DLookUp(sum [Kaina su PVM];[kpo_group_before]) and it did not work

kpo_group_before - is first query name
 

Users who are viewing this thread

Back
Top Bottom