Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sum in a Query (Balance)

Posted on 2014-12-16
9
Medium Priority
?
110 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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 2000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

688 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