Power Fx function
DateDiff — Power Fx function reference
Span between two dates.
Syntax
powerfx
DateDiff( StartDate, EndDate [, Unit ] )
Examples
powerfx
DateDiff(StartDate, EndDate, TimeUnit.Days)
→ A number
powerfx
DateDiff(ThisItem.Created, Now(), TimeUnit.Days)
powerfx
DateDiff(StartDate, EndDate, TimeUnit.Hours) / 24
Common mistakes & gotchas
- Unit defaults to TimeUnit.Days; for Months/Years it counts whole calendar boundaries crossed, not a simple day-count division, so results can look off by one.
- A negative result (EndDate earlier than StartDate) is valid rather than an error — handy for "overdue by N days" without needing Abs().
Related Power Fx functions
From Date & time