SQL for Hourly - Daily Sales

Jun 23, 2009 2 Replies

Hi everyone -



I'm looking for sql to report the average sale per the day of the week. So the total Monday's average sales per hour, the total Tuesday's sales per hour for all the days of the week. Average sale with a rollup on day with sales per hour. At first I'd like to pull data from 1-1-09 through 6-24-09.



Your help would be appreciated.



Mon Tues Wed Thurs Fri Sat Sun



8am
9am
10am
11am
12am
1pm
2pm
3pm
4pm
5pm
6pm
7pm
8pm
9pm

Hi Jerry,

You can use this report off of CustomerSource

formatting link
add the code below and an average column for sales and you will havewhat you want.

Begin Column FieldName = "DayofWeek" DrillDownFieldName = "" DrillDownReportName = "" Title = "Day of Week" VBDataType = vbString Formula = "CASE DATEPART(weekday,[Transaction].Time) WHEN 1 THEN '1- Sunday' WHEN 2 THEN '2-Monday' WHEN 3 THEN '3-Tuesday' WHEN 4 THEN '4- Wednesday' WHEN 5 THEN '5-Thursday' WHEN 6 THEN '6-Friday' WHEN 7 THEN '7-Saturday' ELSE 'Unknown' END" ColHidden = False ColNotDisplayable = False FilterDisabled = False ColWidth = 2100 GroupMethod = groupmethodNone ColFormat = "" End Column

Make sure the Formula is all on one line with no carriage return breaking up the code.

Robert Armstr> Hi everyone -

I'm familiar with sql and executing sql statements. This statement and executing it are unfamiliar to me. If you can explain how to execute it I'll give it a try.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required