Solved

Sum in a Query (Balance)

Posted on 2014-12-16
9
99 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
find first method with 2 variable search criteria 10 48
Microsoft Access report help 4 38
SUBFORM on ACCESS 2013 8 35
Access date picker/Monday dates only 3 14
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

734 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