kohera-logo-regular.svg

Adding Flemish Seasonality to your dataset in SQL

Vector_BG.png

Adding Flemish Seasonality to your dataset in SQL

Vector_BG.png

One of the most challenging tasks in data mining or machine learning is how to get seasonality into the mix. Therefore I created a construct that can insert the seasonality for the Flemish part of Belgium in SQL. With some minor alterations, this can easily be adapted for the Brussels or Walloon regions.

Creating the Belgian (Flemish) national holidays in SQL

Because I could create this fast in SQL and because my initial dataset was SQL Server based, I choose to create this in SQL Server.
If we take the rules on which school holidays are created: http://onderwijs.vlaanderen.be/nl/principes-vakantieregeling, we can see that it is important to correctly determine easter.
This can be done in SQL Server using the following function:

Let’s create a worktable first:

Once we have found Easter, it’s easy to find the school holidays using this peace of code:

 

Because not everyone’s life is coupled with the school holidays, we also have to add the national holidays. Again, this is easily done by adding the following code:

And there you have them, the complete set for Flanders 😉

Enjoy!

2319-blog-database-specific-security-featured-image
Database specific security in SQL Server
There are many different ways to secure your database. In this blog post we will give most of them a...
kohera-2312-blog-sql-server-level-security-featured-image
SQL Server security on server level
In this blog, we’re going to look at the options we have for server level security. In SQL Server we...
blog-security_1
Microsoft SQL Server history
Since its inception in 1989, Microsoft SQL Server is a critical component of many organizations' data infrastructure. As data has...
DSC_1388
Aggregaties
Power BI Desktop is een prachtige tool om snel data-analyses te kunnen uitvoeren. Je connecteert op een databron, importeert en...
dba image
DBA is not that scary
Often when talking to people who are looking for a career path in the data world I feel like there...
blog-2303
How do you link an SCD Type 2 table in Power Query?
This article uses a simple example to demonstrate how to link an SCD Type 2 table in Power Query to...