Trying to create a column that will tell me the weekofyear() as well as the dates:
Week Date org cost
--------------------------------------------
50 "2016/12/12-2016/12/18" 1 400
51 "2016/12/19-2016/12/25" 1 400
52 "2016/12/26" 1 400
So this tells me that Week 52 only includes data from the December 26th and not for the whole week.
here is what my query looks like:
SELECT
weekofyear(date) as week_number,
exchange,
country,
channel,
sum (media_cost) as mc
FROM
imps
WHERE
date BETWEEN '2016-12-26' AND '2017-01-08'
GROUP BY
weekofyear(date) as week_number,
exchange,
country,
channel;
I have looked at How do you get the “week start date” and “week end date” from week number in SQL Server? but this won't solve the issue of seeing what days it does include. Would using bins work for this maybe? What are your suggestions.