PC Review


Reply
Thread Tools Rate Thread

Daily Average

 
 
Dan Robles
Guest
Posts: n/a
 
      23rd Apr 2008
I made a crosstab query that calculates the days of the week that our
students are on campus, and the activities they complete. Now I need to
average the activity for each weekday. Any Advice?
 
Reply With Quote
 
 
 
 
KARL DEWEY
Guest
Posts: n/a
 
      23rd Apr 2008
Post the crosstab SQL, sample data, and how you want the average to be
displayed.
--
KARL DEWEY
Build a little - Test a little


"Dan Robles" wrote:

> I made a crosstab query that calculates the days of the week that our
> students are on campus, and the activities they complete. Now I need to
> average the activity for each weekday. Any Advice?

 
Reply With Quote
 
Dan Robles
Guest
Posts: n/a
 
      23rd Apr 2008
Karl, thanks for your help.

The SQL looks like this:
TRANSFORM Count([Tutoring by Day].Events) AS CountOfEvents
SELECT [Tutoring by Day].Activity, Count([Tutoring by Day].Events) AS [Total
Of Events]
FROM [Tutoring by Day]
GROUP BY [Tutoring by Day].Activity
PIVOT [Tutoring by Day].Day;


The data looks like this:
(I truncated one of the days so that it would fit in the window here)
Activity Total Events Friday Monday Thursday Tuesday
Homework Lab 415 21 161 21 186
Study Hall 1639 143 221 584 327
Tutoring 2357 251 502 658 531

What my boss is looking for is an average number of kids coming in for
homework lab, tutoring, etc. for each day. What do you suggest?
"KARL DEWEY" wrote:

> Post the crosstab SQL, sample data, and how you want the average to be
> displayed.
> --
> KARL DEWEY
> Build a little - Test a little
>
>
> "Dan Robles" wrote:
>
> > I made a crosstab query that calculates the days of the week that our
> > students are on campus, and the activities they complete. Now I need to
> > average the activity for each weekday. Any Advice?

 
Reply With Quote
 
KARL DEWEY
Guest
Posts: n/a
 
      23rd Apr 2008
What data do you store in field Events?

--
KARL DEWEY
Build a little - Test a little


"Dan Robles" wrote:

> Karl, thanks for your help.
>
> The SQL looks like this:
> TRANSFORM Count([Tutoring by Day].Events) AS CountOfEvents
> SELECT [Tutoring by Day].Activity, Count([Tutoring by Day].Events) AS [Total
> Of Events]
> FROM [Tutoring by Day]
> GROUP BY [Tutoring by Day].Activity
> PIVOT [Tutoring by Day].Day;
>
>
> The data looks like this:
> (I truncated one of the days so that it would fit in the window here)
> Activity Total Events Friday Monday Thursday Tuesday
> Homework Lab 415 21 161 21 186
> Study Hall 1639 143 221 584 327
> Tutoring 2357 251 502 658 531
>
> What my boss is looking for is an average number of kids coming in for
> homework lab, tutoring, etc. for each day. What do you suggest?
> "KARL DEWEY" wrote:
>
> > Post the crosstab SQL, sample data, and how you want the average to be
> > displayed.
> > --
> > KARL DEWEY
> > Build a little - Test a little
> >
> >
> > "Dan Robles" wrote:
> >
> > > I made a crosstab query that calculates the days of the week that our
> > > students are on campus, and the activities they complete. Now I need to
> > > average the activity for each weekday. Any Advice?

 
Reply With Quote
 
Dan Robles
Guest
Posts: n/a
 
      23rd Apr 2008
Sorry, Events is simply an Autonumber field.

"KARL DEWEY" wrote:

> What data do you store in field Events?
>
> --
> KARL DEWEY
> Build a little - Test a little
>
>
> "Dan Robles" wrote:
>
> > Karl, thanks for your help.
> >
> > The SQL looks like this:
> > TRANSFORM Count([Tutoring by Day].Events) AS CountOfEvents
> > SELECT [Tutoring by Day].Activity, Count([Tutoring by Day].Events) AS [Total
> > Of Events]
> > FROM [Tutoring by Day]
> > GROUP BY [Tutoring by Day].Activity
> > PIVOT [Tutoring by Day].Day;
> >
> >
> > The data looks like this:
> > (I truncated one of the days so that it would fit in the window here)
> > Activity Total Events Friday Monday Thursday Tuesday
> > Homework Lab 415 21 161 21 186
> > Study Hall 1639 143 221 584 327
> > Tutoring 2357 251 502 658 531
> >
> > What my boss is looking for is an average number of kids coming in for
> > homework lab, tutoring, etc. for each day. What do you suggest?
> > "KARL DEWEY" wrote:
> >
> > > Post the crosstab SQL, sample data, and how you want the average to be
> > > displayed.
> > > --
> > > KARL DEWEY
> > > Build a little - Test a little
> > >
> > >
> > > "Dan Robles" wrote:
> > >
> > > > I made a crosstab query that calculates the days of the week that our
> > > > students are on campus, and the activities they complete. Now I need to
> > > > average the activity for each weekday. Any Advice?

 
Reply With Quote
 
KARL DEWEY
Guest
Posts: n/a
 
      24th Apr 2008
With your data structure you will need two queries --
Tutoring by Day_Rollup ---
SELECT [Tutoring by Day].Day, [Tutoring by Day].Activity, Count([Tutoring by
Day].Events) AS CountOfEvents
FROM [Tutoring by Day]
GROUP BY [Tutoring by Day].Day, [Tutoring by Day].Activity;

TRANSFORM Avg([Tutoring by Day_Rollup].CountOfEvents) AS AvgOfCountOfEvents
SELECT [Tutoring by Day_Rollup].Activity, Avg([Tutoring by
Day_Rollup].CountOfEvents) AS Averages
FROM [Tutoring by Day_Rollup]
GROUP BY [Tutoring by Day_Rollup].Activity
PIVOT [Tutoring by Day_Rollup].Day;

Your table should look like this ---
Activity – text
TutorDate – DateTime – calendar date recorded.
Events – number – number of students attending a particular activity on a
given date.
Then your average crosstab would look like this ---
TRANSFORM Avg([Tutoring by Day].Events) AS AvgOfEvents
SELECT [Tutoring by Day].Activity, Avg([Tutoring by Day].Events) AS [Average]
FROM [Tutoring by Day]
GROUP BY [Tutoring by Day].Activity
PIVOT Format([TutorDate],"dddd") IN("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday");

TRANSFORM Sum([Tutoring by Day].Events) AS SumOfEvents
SELECT [Tutoring by Day].Activity, Sum([Tutoring by Day].Events) AS [Total
Of Events]
FROM [Tutoring by Day]
GROUP BY [Tutoring by Day].Activity
PIVOT Format([TutorDate],"dddd") In ("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday");

--
KARL DEWEY
Build a little - Test a little


"Dan Robles" wrote:

> Sorry, Events is simply an Autonumber field.
>
> "KARL DEWEY" wrote:
>
> > What data do you store in field Events?
> >
> > --
> > KARL DEWEY
> > Build a little - Test a little
> >
> >
> > "Dan Robles" wrote:
> >
> > > Karl, thanks for your help.
> > >
> > > The SQL looks like this:
> > > TRANSFORM Count([Tutoring by Day].Events) AS CountOfEvents
> > > SELECT [Tutoring by Day].Activity, Count([Tutoring by Day].Events) AS [Total
> > > Of Events]
> > > FROM [Tutoring by Day]
> > > GROUP BY [Tutoring by Day].Activity
> > > PIVOT [Tutoring by Day].Day;
> > >
> > >
> > > The data looks like this:
> > > (I truncated one of the days so that it would fit in the window here)
> > > Activity Total Events Friday Monday Thursday Tuesday
> > > Homework Lab 415 21 161 21 186
> > > Study Hall 1639 143 221 584 327
> > > Tutoring 2357 251 502 658 531
> > >
> > > What my boss is looking for is an average number of kids coming in for
> > > homework lab, tutoring, etc. for each day. What do you suggest?
> > > "KARL DEWEY" wrote:
> > >
> > > > Post the crosstab SQL, sample data, and how you want the average to be
> > > > displayed.
> > > > --
> > > > KARL DEWEY
> > > > Build a little - Test a little
> > > >
> > > >
> > > > "Dan Robles" wrote:
> > > >
> > > > > I made a crosstab query that calculates the days of the week that our
> > > > > students are on campus, and the activities they complete. Now I need to
> > > > > average the activity for each weekday. Any Advice?

 
Reply With Quote
 
Dan Robles
Guest
Posts: n/a
 
      24th Apr 2008
Thanks, I'll give this a shot. I'll let you know tomorrow or Friday.

"KARL DEWEY" wrote:

> With your data structure you will need two queries --
> Tutoring by Day_Rollup ---
> SELECT [Tutoring by Day].Day, [Tutoring by Day].Activity, Count([Tutoring by
> Day].Events) AS CountOfEvents
> FROM [Tutoring by Day]
> GROUP BY [Tutoring by Day].Day, [Tutoring by Day].Activity;
>
> TRANSFORM Avg([Tutoring by Day_Rollup].CountOfEvents) AS AvgOfCountOfEvents
> SELECT [Tutoring by Day_Rollup].Activity, Avg([Tutoring by
> Day_Rollup].CountOfEvents) AS Averages
> FROM [Tutoring by Day_Rollup]
> GROUP BY [Tutoring by Day_Rollup].Activity
> PIVOT [Tutoring by Day_Rollup].Day;
>
> Your table should look like this ---
> Activity – text
> TutorDate – DateTime – calendar date recorded.
> Events – number – number of students attending a particular activity on a
> given date.
> Then your average crosstab would look like this ---
> TRANSFORM Avg([Tutoring by Day].Events) AS AvgOfEvents
> SELECT [Tutoring by Day].Activity, Avg([Tutoring by Day].Events) AS [Average]
> FROM [Tutoring by Day]
> GROUP BY [Tutoring by Day].Activity
> PIVOT Format([TutorDate],"dddd") IN("Sunday", "Monday", "Tuesday",
> "Wednesday", "Thursday", "Friday", "Saturday");
>
> TRANSFORM Sum([Tutoring by Day].Events) AS SumOfEvents
> SELECT [Tutoring by Day].Activity, Sum([Tutoring by Day].Events) AS [Total
> Of Events]
> FROM [Tutoring by Day]
> GROUP BY [Tutoring by Day].Activity
> PIVOT Format([TutorDate],"dddd") In ("Sunday", "Monday", "Tuesday",
> "Wednesday", "Thursday", "Friday", "Saturday");
>
> --
> KARL DEWEY
> Build a little - Test a little
>
>
> "Dan Robles" wrote:
>
> > Sorry, Events is simply an Autonumber field.
> >
> > "KARL DEWEY" wrote:
> >
> > > What data do you store in field Events?
> > >
> > > --
> > > KARL DEWEY
> > > Build a little - Test a little
> > >
> > >
> > > "Dan Robles" wrote:
> > >
> > > > Karl, thanks for your help.
> > > >
> > > > The SQL looks like this:
> > > > TRANSFORM Count([Tutoring by Day].Events) AS CountOfEvents
> > > > SELECT [Tutoring by Day].Activity, Count([Tutoring by Day].Events) AS [Total
> > > > Of Events]
> > > > FROM [Tutoring by Day]
> > > > GROUP BY [Tutoring by Day].Activity
> > > > PIVOT [Tutoring by Day].Day;
> > > >
> > > >
> > > > The data looks like this:
> > > > (I truncated one of the days so that it would fit in the window here)
> > > > Activity Total Events Friday Monday Thursday Tuesday
> > > > Homework Lab 415 21 161 21 186
> > > > Study Hall 1639 143 221 584 327
> > > > Tutoring 2357 251 502 658 531
> > > >
> > > > What my boss is looking for is an average number of kids coming in for
> > > > homework lab, tutoring, etc. for each day. What do you suggest?
> > > > "KARL DEWEY" wrote:
> > > >
> > > > > Post the crosstab SQL, sample data, and how you want the average to be
> > > > > displayed.
> > > > > --
> > > > > KARL DEWEY
> > > > > Build a little - Test a little
> > > > >
> > > > >
> > > > > "Dan Robles" wrote:
> > > > >
> > > > > > I made a crosstab query that calculates the days of the week that our
> > > > > > students are on campus, and the activities they complete. Now I need to
> > > > > > average the activity for each weekday. Any Advice?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Daily Average yclhk Microsoft Excel Misc 6 9th Oct 2009 11:16 AM
Getting the Weekly Daily Average Jeff Jensen Microsoft Excel Misc 2 9th Jan 2009 03:51 PM
how do I set up a daily average in excel =?Utf-8?B?QUxBTg==?= Microsoft Excel Programming 2 12th May 2005 12:21 AM
daily average =?Utf-8?B?SkJvdWx0b24=?= Microsoft Excel Worksheet Functions 12 20th Jan 2005 11:13 PM
Daily Average =?Utf-8?B?TUNvcm4=?= Microsoft Excel New Users 2 23rd Feb 2004 08:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:32 PM.