kohera-logo-regular.svg

Adding Flemish Seasonality to your dataset in SQL

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!

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...
featured-2302
How to easily parse JSON in Power BI Desktop
Sometimes you want to use JSON data in Power BI. And sometimes Power BI doesn’t exactly do what you want...
header-2301
Power BI reports as monitoring tool
Who has not created monitoring reports or beautiful dashboards in Power BI? Would it not be great to show off...
your-modernization-journey-starts-now-header
Your Modernization Journey starts now
Recently Microsoft introduced SQL server 2022. We wrote this post to make sure you won’t be missing out on all...