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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate a Dsum only once

Status
Not open for further replies.

GoDawgs

MIS
Apr 1, 2002
670
US
Got a query problem...I have a table with Revenue data for the past year. I need to create a query (that's my first problem, it has to be a query) that basically lists all the stores and revenue, and then I need to calculate what percent of the monthly revenue that day's revenue is (so basically say on the 5th the revenue is $100, and the total month revenue is $1,000, then the 5th is 10%...easy enough).

The problem is I need to calculate the month total (obviously) before I get the percent...and the way I came up with to do this was to use Dsum...this works fine but takes too long since it must recalculate the sum for every record. I only run this query for a specific month, so the Dsum result will be the same for every record...is there any way to somehow store the total first and then have each record dividing a number instead of a Dsum? I could just create another query and pull the number from there, but I'd like to avoid that if at all possible. Anyway, thanks for the help.

Kevin
 
Create a total query first. Then add the total query to your query grid and use that in place of your dsum.
 
Yeah, I thought of that, I was hoping to avoid another query, but that's the only way I see too. Thanks for the help.

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top