Solved

Sum in a Query (Balance)

Posted on 2014-12-16
9
103 Views
Last Modified: 2014-12-16
Experts,
I have a query with [FacilityAmount] and [Amount].  
There are 3 Facilities and each has an [Amount] (this is the amount drawn)
I need to show the [AvailableAmount] for each Facility, which is found by [FacilityAmount] and [Amount]
I think it is quite simple but I dont know how to do it.

I think it will be more clear if you open the attached db and look at the query.

query picDatabase1.accdb
0
Comment
Question by:pdvsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 

Author Comment

by:pdvsa
ID: 40502999
I basically need a sum for [Amount] (this is the amount drawn) but for each [Facility]
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40503024
see query1
Database1Rev.accdb
0
 

Author Comment

by:pdvsa
ID: 40503071
Hi Rey,

I am not sure if the calc is correct because the FacilityAmount is as follows:
Uncovered      $2,915,000,000.00
Nexi             $2,000,000,000.00
JBIC                     $2,500,000,000.00
      
but in the query1 (below) it shows a sum of the FacilityAmount (basically doubling it):  
ie:  JBIC shows 5Billion and it should be 2.5Billiion (as above) and a SumOfAvailable should be: 2.5 - the sum  tblDisbursement_Amounts where it = JBIC

Type      SumOfFacilityAmount      SumOfAvailable
JBIC                $5,000,000,000.00      $4,877,000,000.00
NEXI         $4,000,000,000.00      $3,905,000,000.00
Uncovered      $5,830,000,000.00$5,690,000,000.00

thank you
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40503108
open first the query Q1
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40503115
see Q2 and query2
Database1Rev.accdb
0
 

Author Comment

by:pdvsa
ID: 40503170
Rey:  thank you sir...Can you look at that query2 once more?  

example:  JBIC available should be :  2.5B - sum(25MM+98MM) = 2.377B

The facility amount doesnt appear to be correct.  Ie: JBIC shows 5B and it should be 2.5B.  The sumOfAmount is correct though.
0
 

Author Comment

by:pdvsa
ID: 40503174
all of the [FacilityAmounts] appear to be doubled and not just JBIC
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40503207
ok, first create a query

SELECT tblDisbursement_Amounts.Type, Sum(tblDisbursement_Amounts.Amount) AS SumOfAmount
FROM tblDisbursement_Amounts
WHERE (((tblDisbursement_Amounts.DisbRecdDate) Is Not Null))
GROUP BY tblDisbursement_Amounts.Type;

save as Q_Disbursement

then create this query

SELECT Q_Disbursement.Type, tblFacilityAmounts.FacilityAmount, Q_Disbursement.SumOfAmount, [FacilityAmount]-[SumOfAmount] AS Available
FROM Q_Disbursement INNER JOIN tblFacilityAmounts ON Q_Disbursement.Type = tblFacilityAmounts.Type;


check the result
0
 

Author Closing Comment

by:pdvsa
ID: 40503244
Wow that works.  Now I need to figure out how you did it.  

thank you
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question