Calculate Field Using Sum of Another Field

DBFIN

Registered User.
Local time
Today, 11:04
Joined
May 10, 2007
Messages
205
I want to create a calculated field in a select query.

Cost Per Call = Total Cost / Total Calls

The Total Cost is a fixed value that will be entered after the user is prompted.
The problem is that Total Calls is the sum of another field in the query called # Calls. Is it possible to calculate a field that uses a sum of another field in the query ?
 
Last edited:
Ofcourse. Just save the query and create a new one using the saved query showing the sum. Using the summed field of another query is just a field as any other.
Code:
Select [Total Cost]/[Total Calls] as [Cost per call] from qrySaved
 
My original Query A contains the fields Cost and Calls. I created a new Query B which has two fields: sum of the Total Cost and sum of Total Calls. I also created Query C which depends on Query A and Query B. Query C correctly calculates Cost per Call as [Total Cost] / [Total Calls] from Query B.

My only concern is that Query C has no joins between the two queries it depends on, Query A and Query B because the only fields in Query B are sums, which can't be joined to anything. Is it appropriate to have a query as a data source without joining it to the other data sources in the query ?
 

Users who are viewing this thread

Back
Top Bottom