PowerBI DAX – DATEDIFF

A very common requirement especially for reports that rely on age etc. We use DateDiff function to calculate the difference in intervals between two dates. This provides an idea of overdue invoices, age etc. and was recently used prominently to depict the doubling rate for the COVID 19 virus. Other examples include calculating duration of stay, delayed deliveries etc.

The measure is used as shown below

ExdateDiff = DATEDIFF("2020-01-01","2020-01-05",DAY)

The result will be displayed as shown below

The SQL Equivalent would be

SELECT DATEDIFF(d,'2020-01-01','2020-01-05')

 

1 Reply to “PowerBI DAX – DATEDIFF”

Comments are closed.