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 »Doellijn/Stripline in Reporting Services
Binnen SSRS 2008 R2 is het mogelijk om aan een grafiek een doellijn toe te voegen. Dit kan handig zijn om aan te geven wat bijv. de norm is zodat je snel kunt zien welke waarden er over de norm gaan.
Read More »Excel Pivot online publiceren
Ik vond vandaag een leuk artikel over het online publiceren van een Excel Pivot sheet. Ik heb het zelf nog niet uitgetest maar dat ga ik zeker binnenkort eens doen! http://sqlblog.com/blogs/jamie_thomson/archive/2012/08/13/using-pivot-tables-in-the-office-excel-web-app.aspx
Read More »Centraliseren van KPI’s in je Datawarehouse
Je maakt schitterende rapportages met de mooiste cijfers, omzetten, productiviteit en KPI’s. Door de tijd komen er steeds meer rapportages bij binnen de organisatie. Tot iemand ineens opmerkt dat de waarden van KPI’s niet gelijk zijn tussen de verschillende rapportages. Oops! In dit artikel bespreek ik een manier om te …
Read More »Reset Ident Column in Database
This is a very handy little script to generate a script to reset the ident column of all your database tables. This can be handy after filling and truncating tables. This script uses a schema “ps”. Replace it with .dbo if needed.
Read More »Calculate Weeks Between Two Dates using DateDiff
In SQL Server, there’s a buildin function to calculate the number of weeks between two dates. This function is called “DateDiff”. The problem with this function is that Sql Server thinks the week starts on sunday. Maybe this it true in some situations but at my current project, the week …
Read More »Datawarehouse and Datamart – Empty Strings or NULL Values?
I was wondering what’s the best method to store empty fields from source systems in a datawarehouse. For example;a customer record without a first name stored in the database. When loading this record in my datawarehouse, should I set this field to NULL (to save space) or should I load …
Read More »