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!

Photo of successful woman coder hacker web creator sitting armchair comfortable workspace workstation indoors.
The hurdles and pitfalls of moving or migrating a System-versioned temporal table cross database
Maybe you already have your own way of doing this and are wondering about alternative methods, or maybe you are...
Group of computer programmers working in the office. Focus is on blond woman showing something to her colleague on PC.
Updating your Azure SQL server OAuth2 credentials in Power BI via PowerShell for automation purposes
The better way to update OAuth2 credentials in Power BI is by automating the process of updating Azure SQL Server...
2401-under-memory-pressure-featured-image
Under (memory) pressure
A few weeks ago, a client asked me if they were experiencing memory pressure and how they could monitor it...
2402-fabric-lakehouse-featured-image
Managing files from other devices in a Fabric Lakehouse using the Python Azure SDK
In this blogpost, you’ll see how to manage files in OneLake programmatically using the Python Azure SDK. Very little coding...
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 made easy on the server level
In this blog, we’re going to look at the options we have for server level security. In SQL Server we...