473,849 Members | 1,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.m Amount) 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 2483

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

Similar topics

1
4201
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 something o that object O to modify its real number r. The loop runs 5000 times. I want to draw the real number r. I can draw the grap but only after the for loop finished running. What i want to do is to draw the grap while the for loop still...
2
1763
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 date for that particular course start date. What they want is to start the 20 week running sum from the previous total. for ex
1
2487
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
1148
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 when I combine these 2 queries I can get zero's that will throw off my graph. For instance. Actuals Running Sum jan 10 10 feb 5 15
4
24518
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 'Amount', and also have a field call 'Cumulative' and have the sum grow with each record. Using "MyTable", the query results are... ID or Date Amount Cumulative --------------- ------ ----------
1
5683
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, total miles, total hours and averages stops per mile and stops per hour. The code works for everything but the averages. I get zero in the output field. I've tried lots of different things, all resulting in same output. Results: Car stops ...
5
3983
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 Date Cumulative Sum Daily Sum DC 03-Apr-07 6 6 DC 04-Apr-07 20 14 DC 05-Apr-07 0 0 DC 06-Apr-07 24 4
0
1588
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 ventilator, so we are continousally getting live data from this device in the form of XML Stream. Now i need to plot this live data on a running graph means a moving graph, i am able to plot this on a .Net (C# Window application), But now i have to plot this...
5
4586
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 month and will be segmented by salesman. Each subsequent month / bar thereafter will compose of the running total of sales, again segmented by each salesman. I have a query which has the following fields: Month Salesman SalesVolume$ ...
0
9738
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11005
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10723
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10349
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9501
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7894
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5921
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4139
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.