Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running YTD Totals

Status
Not open for further replies.

crystalhelp

Programmer
May 13, 2002
56
0
0
CA
I posted this on Other Topics, but maybe I should have posted this here. My report has three groupings (Year, Month, Branch). I wrote a stored procedure that successfully returns incidences to be tallied for a specified time period, plus incidences prior to the specified period, necessary for a ytd calulation. So each count is actually referencing two different fields. It does work, with just a bit of a problem I have a branch total, monthly total, and a report total plus all those but based on ytd. See my simplified illustration:

January

Branch Count YTD Count

Branch 1 4 4 ** (see comment)
Branch 2 8 8 ** (see comment)
Total 12 12 (is correct)

February

Branch 1 6 6 (should be 4 + 6 = 10)
Branch 2 9 9 (should be 8 + 9 = 17)
Total 15 27 (is correct)
Total 27 27 (is correct)

** In this example, January YTD is correct, but it wouldn't be correct if the first month in the report is let's say February, because as you can see the branches are resetting themselves. I've played around with the running total, and I have gotten different results, but so far not the right result. Does anyone know the approach/formula to get it to do what I want it to?
 
Evaluate for each and reset never causes the branches to total together. I want a running total, but for each branch to have it's own running total. These were my results:

January

Branch Count YTD Count

Branch 1 4 4
Branch 2 8 12 (should be 8)
Total 12 12

February

Branch 1 6 18 (should be 10)
Branch 2 9 27 (should be 17)
Total 15 27
Total 27 27

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top