473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Running Sum / Cumulative Total Graph

I have searched through the news groups and found many threads close to
what I want but cannot get any of them to work...

I have a table with expenses and invoices, what I want is a bar chart
with value on the y-axis, time on the x-axis and two series...
cumulative expenses and cumulative invoices so I can compare them
against each other against time.

What I have tried to do is create a runing sum column using the SQL
code as follows...

SELECT qryAllOut.mKey AS [Key], Sum(qryAllOut.mAmount) AS
CumulativeOut, DSum("[mAmount]","[qryAllOut]","[InOutQuote] = 'Out' And
[mKey]<=" & [Key] & "") AS RsumOut,
DSum("[mAmount]","[qryAllOut]","[InOutQuote] = 'In' And [mKey]<=" &
[Key] & "") AS RsumIn, qryAllOut.mDate
FROM qryAllOut
GROUP BY qryAllOut.mKey, qryAllOut.mDate;

The gives me a column of cumulative expenses going out, and a
cumulative invoices going out. However this table looks something like
this...

mKey SumIn SumOut Date In/Out
-------------------------------------------
1 1000 31/03/2006 In
2 2000 28/04/2006 In
3 4000 05/06/2006 In
4 4000 50 10/03/2006 Out
5 4000 150 15/03/2006 Out

etc.

Firstly is their any way to stop the SumIn column registering a value
when the In/Out value is Out? Otherwise this screws up my values when
i reorganise by date.

Is it possible to do running total by data and not using the unique
key.

Is it possible to not use SQL all together and create sum kind of
function in VBA to do it (I hate SQL and am much more familar with VBA)

My only other problem is that when I try to create a graph out of what
I have, it will not let me assign the Sum of the columns SumIn and
SumOut only the count... this is because the columns are defined as
text and not numeric values - however SQL will not allow to change
these column as it results in an error in my code.

Please help as I am pulling my hair out here! SO frustrating!

Cheers,
James Hallam

Aug 7 '06 #1
0 2445

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: noise | last post by:
Hello, I have problem with drawing running graph. What I want to draw is: I have an object O which as a real number r associated with it. In the main() (in main class) i have a for loop which do...
2
by: Peter Bailey | last post by:
I have a query that creates a graph of bookings from the course start date looking back 20 weeks based on a running sum. I also have a query that counts the number of bookings before that 20 week...
1
by: Victor | last post by:
Hi There, I have a query witch gives me the following result: Period NumberOfItems 1 13 2 2 3 1 4 1 5 1
0
by: turtle | last post by:
I am trying to create a graph that shows the running sum of budget compared to actuals. I have setup union queries that work great for getting the running sum for budgets and actuals. However...
4
by: cefrancke | last post by:
Are there any ways to speed up a Cumulative sum in a query or perhaps another faster way to have a cumulative sum column (call a vba function?). For example, I want to sum up all values under...
1
by: medphillips | last post by:
I am new to SQL so forgive me if this is an SQL 101 question. I have 2 tables relating to vehicle use by employees. I am creating a report to give me totals on number of vehicles, total stops,...
5
by: mebrabham | last post by:
Hello, I am trying to create a running subtotal in a query and then graph the running subtotal for each city group. The data looks like this in the table (for illustration): My City My...
0
by: jatininfo | last post by:
Hi.. I am working on a medical device which will give the various current reading of various types of parameter from patient body like oxygen lavel, breathing, tampature etc, and it's a...
5
by: BillShaw | last post by:
Using Access 2003 I am trying to construct a query to provide data for a stacked column graph to show cumulative sales figures month on month individually by salesman. Eg. a column will represent a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.