Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
day generator for powerpivot with weekday and holiday subselect!!! mssql 2012, powerpivot excel 2016
+ subselect for holiday subselect
with [dates] as (
select convert(datetime, '2016-01-01') as [date] --start
union all
select dateadd(day, 1, [date])
from [dates]
where [date] < '2018-01-01' --end
select [date]
, DATEPART (y,[date]) as Jahr
, DATEPART (m,[date]) as Monat
, DATEPART (dw,[date]) as Wochentag
, (select holidayname from holidaytable
where holidaytable.hdate = [date])
as Feiertag
from [dates]
where [date] between '2016-01-01' and '2016-31-12'
option (maxrecursion 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment