--Script # 1: To generate steps history of all jobs USE msdb GO SELECT j.name JobName,h.step_name StepName, CONVERT(CHAR(10), CAST(STR(h.run_date,8, 0) AS dateTIME), 111) RunDate, STUFF(STUFF(RIGHT('000000' + CAST ( h.run_time AS VARCHAR(6 ) ) ,6),5,0,':'),3,0,':') RunTime, h.run_duration StepDuration, case h.run_status when 0 then 'failed' when 1 then 'Succeded' when 2 then 'Retry' when 3 then 'Cancelled' when 4 then 'In Progress' end as ExecutionStatus, h.message MessageGenerated FROM sysjobhistory h inner join sysjobs j ON j.job_id = h.job_id ORDER BY j.name, h.run_date, h.run_time GO

| Column | Description |
|---|---|
| [JobName] | Name of job as specified |
| [StepName] | Name of step as specified |
| [RunDate] | Date when job run |
| [RunTime] | Time when job run |
| [StepDuration] | Duration in seconds that a step took to complete |
| [ExecutionStatus] | Execution status of step |
| [MessageGenerated] | Message generated at end of step |


![[PowerBI][DAX] – DISTINCTCOUNT() dax powerbi fonction distinctcount](https://i0.wp.com/mybicoach.bwabwanet.fr/wp-content/uploads/2020/03/powerbi-dax-distinctcount.png?resize=100%2C70)



![[PowerBI][DAX] – Comment compter le nombre de ligne d’une table ?](https://i2.wp.com/mybicoach.bwabwanet.fr/wp-content/uploads/2020/01/powerbi-dax-countrows-logo-1.png?resize=100%2C70)