Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CALCULATE IN QUERIES

Status
Not open for further replies.

netrusher

Technical User
Feb 13, 2005
952
0
0
US
I have a query with several number columns and I would like to disply the totals of those columns in the query or elsewhere. Any advice??
 
Add another column to your query (third in this example).
First column: TaxRate
Second column: TaxableIncome
Third column: TaxDue: ([TaxRate] * [TaxableIncome])
HTH


---------------------------------------
The customer may not always be right, but the customer is ALWAYS the customer.
 
HTH,

Thank you!

I am very new to this so I probably did not explain myself well.

I have two columns in my query that have numbers in them.
I want to just have a total of each column and divide it by a certain number of days to come up with a average number for those days. How can I do that and where will it display?

Thanks again.
 
You can do it in a separate query, using the appropriate SUM([yourfield]) or AVG([yourfield]) aggregate functions. Use GROUP BY to aggregate the columns desired.

If you need more help, post more details about what you're trying to accomplish and someone will try to point you in the right direction.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
SUM(yourcolumn) - gives the sum of all the values in the column

Count(yourcolumn) - gives the count of all the values in the column

then you can easily get the average from these two numbers...

or i guess you can use the AVG() function...

-SecondToNone

 
You could also put those formulas into the report instead of putting them in a separate query.
If you want to hard code a number that is used as the divisor:
Divide30: Sum([ThisTable]![TaxableIncome])/30
BTW Greg - great quote!

---------------------------------------
The customer may not always be right, but the customer is ALWAYS the customer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top