Wanneer je met buttons werkt in Power BI om bijvoorbeeld met bookmarks te werken is het handig om te zien welke “view” actief is in je rapport. Het lijkt een beetje op het principe van een web navigatie. Door de actieve bookmark op de button zichtbaar te maken wordt het …
Read More »DAX Set column to Zero based on Username()
Cannot truncate table because it is being referenced by a FOREIGN KEY constraint
Using Microsoft SQL Server, you cannot truncate or drop a table with a foreign key constraint. For example, when you have a client table and a country table. When the client table has a foreign key constraint to the country table, you cannot truncate the country table in this situation …
Read More »Setup sp_send_dbmail attachment included!
I need to setup a weekly report for one of my customers. The report can be manually run by executing a T-SQL statement and copy the result to Excel. After copying, it’s emailed to the client. By using sp_send_dbmail attachment options, you can automate this process.
Read More »Calculate Age in SQL Server
In my daily work, I need to calculate and report the age of people very often. There are a couple of ways to calculate the age and will give you the right result. I do not recommend a SQL Function to to this. SQL Functions are performing very slow, especially …
Read More »T-TSQL – Create 4 week Moving Total
This article will offer you a way to calculate a 4 week moving total in SQL using SQL Server. There are more ways to Rome but this is a way you can use to calculate it using a date dimension.
Read More »Postcoderange opsplitsen naar losse records
Calculate Lost Customers using T-SQL
A common question in the Business Intelligence world from customers is “how many customers did we lose this year” ? Businesses wants to know this so they can act faster to keep customers doing business with them. In this article, I will help you to create SQL to calculate this …
Read More »How To Find the slowest SQL Queries
This stored procedure displays the top worst performing queries based on CPU, Execution Count, I/O and Elapsed_Time as identified using DMV information. This can be display the worst performing queries from an instance, or database perspective. The number of records shown, the database, and the sort order are identified by …
Read More »Interesting Course about data visualisation from Google
Making Sense of Data Do you work with surveys, demographic information, evaluation data, test scores, or observation data? Are you interested in making the data you collect more useful by organizing it, analyzing it, and applying it in different ways? This self-paced, online course is intended for anyone who …
Read More »How to Refresh Reporting Services Cache?
I am working for a client which uses a Datawarehouse in which the data is loaded once a day during the night. During the rest of the day, nothing changes in the datawarehouse. After a couple of years, the database grows and grows and reports are getting slower and slower. …
Read More »Calculate time in hours and minutes between two dates
Sounds easy right? I want to calculate the difference in hours and minutes between two dates. A good readable notition for my report. I want a format like this: 00:36:53 OR 02:13:45 This can easy be done using a T-SQL Statement like this: CONVERT(nvarchar(64), EindDatum-StartDatum, 108) AS DurationCONVERT(nvarchar(64), EindDatum-StartDatum, 108) AS …
Read More »After update trigger
Soms is het handig om een mutatiedatum of mutatieuser bij te houden op een veld, met name in een master data omgeving. Je kunt hiervoor gebruik maken van een trigger op een tabel. Dit moet zowel werken als er nieuwe data wordt ingevoerd als wanneer er data wordt bijgewerkt.
Read More »Dichtstbijzijnde werkdag uitrekenen
Ik had vorige week een leuke uitdaging. In de KPI tabel die ik gebruik voor bepaalde rapportages zijn enkel de normale werkdagen uitgerekend, maandag t/m vrijdag. Feestdagen komen ook voor. De weekenden zijn hier bewust uitgelaten ivm FTE tellingen die anders niet lekker lopen.
Read More »Nederlandse feestdagen in SQL Server
Er is helaas niet een standaard functie in SQL Server om te bepalen of een bepaalde datum een feestdag is. Om dit te bepalen is het handig om gebruik te maken van een datumdimensie zoals hier uitgelegd.
Read More »