Solved

Sum in a Query (Balance)

Posted on 2014-12-16
9
91 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
  • 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
I suddenly cannot write to C drive 20 72
Access query expression 6 20
Reference Controls on subforms 7 27
Access: Retrieving Current Month's Orders for Invoice 6 27
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

786 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