Since I could not find any downloadable PowerBI reports that give insight in scheduled job/jobstep/package run times on our SQL Server I made some myself. I thought I'd share it with you. I cannot find an option to attach the reports so you have to make those yourself. But I'll explain the process and give the code for some views that are needed for the data. You need the rights to deploy and read those views otherwise it won't work. Here are some screenshots of the reports we use. I'm from Holland so you'll see some Dutch language. Doorlooptijd / dlt = run time in Dutch.
Top level info about scheduled jobs/jobsteps/packages, only recent data (last 3 days):
A bit more detail about total run times per day and the objects with the top run times:
First view, job and jobstep information:
CREATE VIEW [Beheer].[doorlooptijden_jobs_jobsteps] AS SELECT h.server , CASE h.step_id WHEN 0 THEN 'Job' ELSE 'Jobstep' END type , j.name AS job , step_name AS stap , cast(cast(h.run_date AS varchar) + ' ' + format (h.run_time, '00:00:00') AS datetime) AS start , CASE WHEN h.run_duration < 0 THEN '00:00:00' ELSE format (h.run_duration, '00:00:00') END AS doorlooptijd , CASE WHEN CAST(h.run_duration AS int) > 235959 THEN 0 -- doorlooptijden groter dan 23:59:59 passen niet in een datetime ELSE DATEDIFF(second,0,cast(cast(format (h.run_duration, '00:00:00') AS time) AS datetime)) END AS doorlooptijd_sec , CASE h.run_status WHEN 0 THEN 'Failed' WHEN 1 THEN 'Succeeded' WHEN 2 THEN 'Canceled' WHEN 3 THEN 'Retry' ELSE 'Onbekend' END status FROM msdb.dbo.sysjobs j JOIN msdb.dbo.sysjobhistory h ON j.job_id = h.job_id
Second view, package information:
SELECT -- Overzicht van uitgevoerde packages volgens de catalog
op.server_name AS server
, project_name AS project
, package_name AS package
, cast (MIN (exestats.start_time) AS DATETIME) AS start
, CONVERT(varchar, DATEADD(ss, datediff (ss, MIN (exestats.start_time), MAX (exestats.end_time)), 0), 108) AS doorlooptijd
, datediff (ss, MIN (exestats.start_time), MAX (exestats.end_time)) AS doorlooptijd_sec
, CASE op.status WHEN 1 THEN 'Created'
WHEN 2 THEN 'Running'
WHEN 3 THEN 'Canceled'
WHEN 4 THEN 'Failed'
WHEN 5 THEN 'Pending'
WHEN 6 THEN 'Ended unexpectedly'
WHEN 7 THEN 'Succeeded'
WHEN 8 THEN 'Stopping'
WHEN 9 THEN 'Completed'
ELSE 'Onbekend' END status
FROM ssisdb.[internal].[executions] exe
JOIN ssisdb.[internal].[operations] op ON exe.execution_id = op.operation_id
JOIN ssisdb.[internal].[executable_statistics] exestats ON exe.execution_id = exestats.execution_id
GROUP BY exe.execution_id
, exe.project_name
, exe.package_name
, op.server_name
, op.status
Third view, combine the other views into one:
CREATE VIEW [Beheer].[doorlooptijden_pbi] AS SELECT [type] , job + ' ' + stap COLLATE Latin1_General_CI_AS AS object , [start] , [doorlooptijd] , [doorlooptijd_sec] , [status] , format(start,'dd') AS dag , format(start,'yyyy MM') AS maand FROM [MetaData].[Beheer].[doorlooptijden_jobs_jobsteps] WHERE start >= cast(format(getdate()-180,'yyyyMM01') AS date) UNION ALL SELECT 'Package' AS type ,project + ' ' + package as object , [start] , [doorlooptijd] , [doorlooptijd_sec] , [status] , format(start,'dd') AS dag , format(start,'yyyy MM') AS maand FROM [MetaData].[Beheer].[doorlooptijden_packages] WHERE start >= cast(format(getdate()-180,'yyyyMM01') AS date)
Finally, import the data from the last view into PowerBI and if you are a basic user you can make the reports in no time, there are no special formulas you have to make (well maybe simple DAX SUM(doorlooptijd_sec) or something) and the report can be made with the default visualisations. I do recommend using the Chicklet slicer for the buttons.