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
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)
Think of the numbers above as the "Average Friday Sales per Week for the Month".
is pronounced ree-bar and is a Modenism for R
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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Helpful Links:
How to post code problemsHow to post performance problemsForum FAQs