473,769 Members | 3,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calculating totals in a query

Performance_Dat e SumOfBudget_NOI CurrYTD_BudgetN OI_Total
1/1/2004 $4,184,626.00 ?
2/1/2004 $4,484,710.00 ?
3/1/2004 $4,537,424.00 ?
4/1/2004 $4,826,850.00 ?
5/1/2004 $4,966,326.00 ?

Can someone help? What I am trying to do is create a query that will
end up looking like the bottom example. The above query is a
calculated totals query with an aggregate sum function. What it is
doing is summing up all the Budget_NOIs for the month of January and
outputting it as shown (I got that done). And it will do that for
every month as time progresses. What I need help doing is calculating
the portion with the question marks. What I need it to do (below
there is an example on how I want it to look) is sum up all the
SumOfBudget_NOI s from January to the current month. For example, the
February amount would be the sum of both January's and February's
SumOfBudget_NOI . For March, it will be the sum January's, February's
and March's SumOfBudget_NOI . For April, it will be the sum January's,
February's, March's and April's SumofBudget_NOI . And so on for the
other months to come. I really have no idea how to approach this
problem. Any suggestions.
THANKS!

Performance_Dat e SumOfBudget_NOI CurrYTD_BudgetN OI_Total
1/1/2004 $4,184,626.00 $4,184,626.00
2/1/2004 $4,484,710.00 $8,669,336.00
3/1/2004 $4,537,424.00 $13,206,760.00
4/1/2004 $4,826,850.00 $18,033,610.00
5/1/2004 $4,966,326.00 $22,999,936.00
Nov 13 '05 #1
3 1662
In the vb window (hit altF11) look up dateserial and associated
functions.

here's an example by grouped by date not month but you will get the
idea.

select pd, sum(b) as monthb,
first(
(select sum(pd) from tbl where month(pd) between 1 and month(pd)+1)
) as ytd
from tbl
group by pd;

Paul Mendez <pm*****@thelyn dco.com> posted in
news:99******** *************** ***@posting.goo gle.com
Performance_Dat e SumOfBudget_NOI CurrYTD_BudgetN OI_Total
1/1/2004 $4,184,626.00 ?
2/1/2004 $4,484,710.00 ?
3/1/2004 $4,537,424.00 ?
4/1/2004 $4,826,850.00 ?
5/1/2004 $4,966,326.00 ?

Can someone help? What I am trying to do is create a query that will
end up looking like the bottom example. The above query is a
calculated totals query with an aggregate sum function. What it is
doing is summing up all the Budget_NOIs for the month of January and
outputting it as shown (I got that done). And it will do that for
every month as time progresses. What I need help doing is calculating
the portion with the question marks. What I need it to do (below
there is an example on how I want it to look) is sum up all the
SumOfBudget_NOI s from January to the current month. For example, the
February amount would be the sum of both January's and February's
SumOfBudget_NOI . For March, it will be the sum January's, February's
and March's SumOfBudget_NOI . For April, it will be the sum January's,
February's, March's and April's SumofBudget_NOI . And so on for the
other months to come. I really have no idea how to approach this
problem. Any suggestions.
THANKS!

Performance_Dat e SumOfBudget_NOI CurrYTD_BudgetN OI_Total
1/1/2004 $4,184,626.00 $4,184,626.00
2/1/2004 $4,484,710.00 $8,669,336.00
3/1/2004 $4,537,424.00 $13,206,760.00
4/1/2004 $4,826,850.00 $18,033,610.00
5/1/2004 $4,966,326.00 $22,999,936.00


--
Phil
Nov 13 '05 #2
that seems a little too complex for me, what and where did you want me
to put that. i thought i knew enough to understand, but i was so
wrong. Thanks Phil!
"Phil" <st***@basketba ll.net> wrote in message news:<AF******* ************@ne wssvr24.news.pr odigy.com>...
In the vb window (hit altF11) look up dateserial and associated
functions.

here's an example by grouped by date not month but you will get the
idea.

select pd, sum(b) as monthb,
first(
(select sum(pd) from tbl where month(pd) between 1 and month(pd)+1)
) as ytd
from tbl
group by pd;

Paul Mendez <pm*****@thelyn dco.com> posted in
news:99******** *************** ***@posting.goo gle.com
Performance_Dat e SumOfBudget_NOI CurrYTD_BudgetN OI_Total
1/1/2004 $4,184,626.00 ?
2/1/2004 $4,484,710.00 ?
3/1/2004 $4,537,424.00 ?
4/1/2004 $4,826,850.00 ?
5/1/2004 $4,966,326.00 ?

Can someone help? What I am trying to do is create a query that will
end up looking like the bottom example. The above query is a
calculated totals query with an aggregate sum function. What it is
doing is summing up all the Budget_NOIs for the month of January and
outputting it as shown (I got that done). And it will do that for
every month as time progresses. What I need help doing is calculating
the portion with the question marks. What I need it to do (below
there is an example on how I want it to look) is sum up all the
SumOfBudget_NOI s from January to the current month. For example, the
February amount would be the sum of both January's and February's
SumOfBudget_NOI . For March, it will be the sum January's, February's
and March's SumOfBudget_NOI . For April, it will be the sum January's,
February's, March's and April's SumofBudget_NOI . And so on for the
other months to come. I really have no idea how to approach this
problem. Any suggestions.
THANKS!

Performance_Dat e SumOfBudget_NOI CurrYTD_BudgetN OI_Total
1/1/2004 $4,184,626.00 $4,184,626.00
2/1/2004 $4,484,710.00 $8,669,336.00
3/1/2004 $4,537,424.00 $13,206,760.00
4/1/2004 $4,826,850.00 $18,033,610.00
5/1/2004 $4,966,326.00 $22,999,936.00

Nov 13 '05 #3
in the query design use the sql view and copy and paste this sql. But
you have to give it your own field and table names, these are just for
example.

in the vba you can open up help and search for month and other date
functions. they allow you to manipulate dates in sql.

this example just shows how to use a subquery for getting the running
total.

post exact field names and I can make it for you. Then when you hit the
visual design window for queries you can see how it is done there.
Paul Mendez <pm*****@thelyn dco.com> posted in
news:99******** *************** **@posting.goog le.com
that seems a little too complex for me, what and where did you want me
to put that. i thought i knew enough to understand, but i was so
wrong. Thanks Phil!
"Phil" <st***@basketba ll.net> wrote in message
news:<AF******* ************@ne wssvr24.news.pr odigy.com>...
In the vb window (hit altF11) look up dateserial and associated
functions.

here's an example by grouped by date not month but you will get the
idea.

select pd, sum(b) as monthb,
first(
(select sum(pd) from tbl where month(pd) between 1 and
month(pd)+1) ) as ytd
from tbl
group by pd;

Paul Mendez <pm*****@thelyn dco.com> posted in
news:99******** *************** ***@posting.goo gle.com
Performance_Dat e SumOfBudget_NOI CurrYTD_BudgetN OI_Total
1/1/2004 $4,184,626.00 ?
2/1/2004 $4,484,710.00 ?
3/1/2004 $4,537,424.00 ?
4/1/2004 $4,826,850.00 ?
5/1/2004 $4,966,326.00 ?

Can someone help? What I am trying to do is create a query that
will end up looking like the bottom example. The above query is a
calculated totals query with an aggregate sum function. What it is
doing is summing up all the Budget_NOIs for the month of January and
outputting it as shown (I got that done). And it will do that for
every month as time progresses. What I need help doing is
calculating the portion with the question marks. What I need it to
do (below there is an example on how I want it to look) is sum up
all the SumOfBudget_NOI s from January to the current month. For
example, the February amount would be the sum of both January's and
February's SumOfBudget_NOI . For March, it will be the sum
January's, February's and March's SumOfBudget_NOI . For April, it
will be the sum January's, February's, March's and April's
SumofBudget_NOI . And so on for the other months to come. I really
have no idea how to approach this problem. Any suggestions.
THANKS!

Performance_Dat e SumOfBudget_NOI CurrYTD_BudgetN OI_Total
1/1/2004 $4,184,626.00 $4,184,626.00
2/1/2004 $4,484,710.00 $8,669,336.00
3/1/2004 $4,537,424.00 $13,206,760.00
4/1/2004 $4,826,850.00 $18,033,610.00
5/1/2004 $4,966,326.00 $22,999,936.00


--
Phil
Nov 13 '05 #4

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

Similar topics

13
2395
by: | last post by:
I have an Access database used to track donor pledges. In it, there is a table that contains three fields for each donor: Gift_Amount, Gift_Per_Year, and Matching_Gift_Ratio. The following formula would calculate the total pledge amount for each donor: (Gift_Amount * Gift_Per_Year) * (Matching_Gift_Ratio + 1). A total Pledge for all donors would just sum up the calculated values.
4
4863
by: The Bit Bandit | last post by:
Hopefully someone can help me create a query that I'm having some trouble with. I have three tables: invoices, invoicedetails, invoicepayments The fields are: invoices -------- InvoiceNo
2
35895
by: mhodkin | last post by:
I created a query in which I have grouped data by City. I wish to calculate the percent of each value, e.g. City/(Total count of all Cities), in tbe next column of the query. I can't seem to write the correct expression due to the "groupby" needed to group the city count in the first column. Any clues?
4
3398
by: New Guy | last post by:
I'm trying to work with a system that somebody else built and I am confounded by the following problem: There is a table of payments and a table of charges. Each client has charges and payments during the month. I'd like to get the totals of the payments and of the charges for each client. When I run the following query, I get huge numbers that appear as if the join is not working correctly.
2
2707
by: BerkshireGuy | last post by:
I have the following code: Dim strSQL As String Dim DB As DAO.Database Dim RS As DAO.Recordset Dim intNumOfPaid, intNumOfHypoed, intNumOfNotTaken, intNumOfDeclined, intNumOfWasted, intNumOfApproved As String Dim QDF As QueryDef Dim PARAM As Parameter
2
2312
by: Tim Marshall | last post by:
Wondering if anyone has any suggestions for this. Sometimes in the form reports my users run, a data sheet subform on a main form, with totals in text boxes with calculated controlsources (=sum(whatever)), the records returned are large. By "large" I mean that there is a significant lag time before the totals get calculated and display. Lag time and what constitutes "large" varies with the user's PC hardware/configuration.
5
9436
by: jonm4102 | last post by:
I'm trying to calculate the median of some numerical data. The data can only be found in a query (henceforth query 1) field I previously made, and I would prefer to calculate the median in a new query it without making a table out of query 1. I can't find a median function in the "Total" field, so is there so way to make an expression to calculate the median of the orignial data from query 1 in my new query? Also, what does name by...
38
9144
by: d0ugg | last post by:
I'm writing a program that will have to roll the dice A and dice B one million times, and calculate the percentage of times that the dies will be equal. I'm having trouble to figure out how the percentage will work. Here is my code: #include <ctime> #include <iostream> using namespace std;
25
3212
by: Blaize | last post by:
Hi, I'm having an issue trying to calculate time. Its okay if the value does not exceed 24 hours otherwise I get a date and hours listed. For example, I have a loop which looks through a table and adds up the time spent. Dim TempCount As Date Dim DEVCount As Date Do TempCount = rst!wtime
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10205
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
9984
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
9851
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
8863
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...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
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.