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!

Parameter sniffing solved with new Parameter Sensitive Plan Optimization feature
If you’re someone that works a lot with Microsoft SQL Server, there’s no doubt that you’ve had issues with an issue called “Parameter sniffing” before....
Creating maps with R and Power BI
The possibilities are infinite when it comes to creating custom visuals in Power BI. As long as you are creative and have knowledge about the...
Reading notifications
Sending monitoring alerts through Telegram
What if you could get the ease of phone notifications for whatever monitoring alerts you need? Then we have a solution for you with the...
Send mails with Azure Elastic Database Jobs
The DatabaseMail feature in SQL Server and Managed Instance is widely used by many professionals. But what if you want similar functionality in Azure SQL...
Sorting matrices in Power BI
Recently I worked on a Power BI project for a client. They had a SharePoint site where they regularly published articles and wanted to pour...
The world of data is evolving
The data landscape has changed dramatically over recent years, the world of data is evolving. In the past, we mainly heard that we needed to...