Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Hires by month issue Expand / Collapse
Author
Message
Posted Wednesday, February 5, 2014 2:17 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, July 24, 2014 9:11 AM
Points: 73, Visits: 423
our company is in the clothing hire business. Ive just started with them and they have no reporting to speak off

Most of thier hire orders fall on Friday and Saturday as thats when the majority of the functions tend to be. they are keen to accurately compare hires for coming months with previous months, the problem they have always faced in doing this is some months have more weekend hire days than others


ie.
march 2013 5xfriday & 5xSaturday
march 2014 4xfriday & 5xSaturday


is there any clean way to actually do this comparison, or is this only possible if you break the year down into 4 week months starting from the first weekend of the year?

thanks
Post #1538377
Posted Wednesday, February 5, 2014 2:58 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 8:06 PM
Points: 36,786, Visits: 31,243
Divide all totals by the number of days (Fridays, for example) contained in a given month and then multiply by 5. Think of it as a normalized total.

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1538386
Posted Wednesday, February 5, 2014 3:17 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, July 24, 2014 9:11 AM
Points: 73, Visits: 423
Jeff Moden (2/5/2014)
Divide all totals by the number of days (Fridays, for example) contained in a given month and then multiply by 5. Think of it as a normalized total.



thanks for the reply, hmm not quite following you :-( brain is prob sleeping now.


for talking sake say i was comparing order value.

march 2013 my order value was $1000
march 2014 my order values is also $1000

but 2013 had one more friday so although the two months look as though they performed the same, 2014 was better as it had fewer days to work with.


sorry if im being dumb lol

Post #1538391
Posted Wednesday, February 5, 2014 6:00 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 8:06 PM
Points: 36,786, Visits: 31,243
ps_vbdev (2/5/2014)
Jeff Moden (2/5/2014)
Divide all totals by the number of days (Fridays, for example) contained in a given month and then multiply by 5. Think of it as a normalized total.



thanks for the reply, hmm not quite following you :-( brain is prob sleeping now.


for talking sake say i was comparing order value.

march 2013 my order value was $1000
march 2014 my order values is also $1000

but 2013 had one more friday so although the two months look as though they performed the same, 2014 was better as it had fewer days to work with.


sorry if im being dumb lol



As you say, 2013 had 5 Fridays and 2014 had 4 Fridays. That means that if both months has $1000, 2013 actually did worse than 2014. Let's see that work according to the math I spoke of.

 SELECT  Mar2013 = 1000/5*5 --1000 / number or Fridays in month * 5
,Mar2014 = 1000/4*5 --1000 / number or Fridays in month * 5
;


Results:

Mar2013     Mar2014
----------- -----------
1000 1250



Think of the numbers above as the "Normalized Sales for the Month". If there had been 5 Fridays in 2014, it's likely it would have had 1250 for the month.

The numbers aren't "real" but do indicate, relatively speaking which month did better by taking the number of weeks into consideration. The "5" in both forumlas could be any constant but either 1 or 5 seem to be the easiest to understand. "5" is used to "normalize" all months to a 5 week period. If you use "1" instead, then you end up with the average performance by week for the month. For example...

 SELECT  Mar2013 = 1000/5 --1000 / number or Fridays in month (Times 1 is implied)
,Mar2014 = 1000/4 --1000 / number or Fridays in month (Times 1 is implied)
;


Results:

Mar2013     Mar2014
----------- -----------
200 250



Think of the numbers above as the "Average Friday Sales per Week for the Month".


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1538435
Posted Thursday, February 6, 2014 2:14 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, July 24, 2014 9:11 AM
Points: 73, Visits: 423
"The "5" in both forumlas could be any constant but either 1 or 5 seem to be the easiest to understand"


so the 5 is an arbitrary value that is commonly used for the normalization calculation or is it based on the max number of Fridays a month COULD have.

Thanks Jeff for your time, excellent explanation.
Post #1538519
Posted Monday, February 17, 2014 11:33 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 8:06 PM
Points: 36,786, Visits: 31,243
ps_vbdev (2/6/2014)
"The "5" in both forumlas could be any constant but either 1 or 5 seem to be the easiest to understand"


so the 5 is an arbitrary value that is commonly used for the normalization calculation or is it based on the max number of Fridays a month COULD have.

Thanks Jeff for your time, excellent explanation.


Sorry for the delayed response. I picked the number "5" because it's the maximum number of Fridays that any month could have.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1542382
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse