UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Averaging Of Query Results, Access 2016    
 
   
mcbrox
post Apr 16 2018, 01:27 PM
Post#1



Posts: 59
Joined: 13-June 12
From: Sunny (& Muggy) Florida


I have a table that collects USDA commodity prices.

It is inputted anywhere from 2 to 5 times per week, and reported by three sizes.
So my query, qryUSDAPrices, as:

Season – calculated as a DatePart from the date of USDA report
Week – calculated as a DatePart from the date of USDA report
Pack - USDA size
Price - USDA price
USDA_Ret - calculation, with variables from USDA size and price.


From the attached screenshot, I would like the results of the query to show:

Season Week USDA_Ret
2018 14 3.296
2018 15 4.336

So I started a new query, with my SQL as:

SELECT Week, AVG(USDA_Ret) AS AvgReturn
FROM qryUSDAPrices
GROUP BY Area

But it returns result:

Your query does not include the specific expression ‘Week’ as part of an aggregate function.

What am I missing?
Attached File(s)
Attached File  Screen1.png ( 51.1K )Number of downloads: 0
 
Go to the top of the page
 
cheekybuddha
post Apr 16 2018, 02:20 PM
Post#2


UtterAccess VIP
Posts: 9,668
Joined: 6-December 03
From: Telegraph Hill


You're nearly there!
CODE
SELECT Season, Week, AVG(USDA_Ret) AS AvgReturn
FROM qryUSDAPrices
GROUP BY Season, Week;


hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
mcbrox
post Apr 16 2018, 03:16 PM
Post#3



Posts: 59
Joined: 13-June 12
From: Sunny (& Muggy) Florida


you'll understand when i say i'm not the greatest finisher...

thanks
Go to the top of the page
 
cheekybuddha
post Apr 16 2018, 05:46 PM
Post#4


UtterAccess VIP
Posts: 9,668
Joined: 6-December 03
From: Telegraph Hill


Sometimes we just need a nudge in the right direction!

yw.gif

--------------------


Regards,

David Marten
Go to the top of the page
 
mcbrox
post Apr 16 2018, 06:08 PM
Post#5



Posts: 59
Joined: 13-June 12
From: Sunny (& Muggy) Florida


Could you help with this one?

http://www.UtterAccess.com/forum/index.php...2048628&hl=
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    22nd April 2018 - 05:48 AM