Power QueryExercises

Duration.Days

Date function · By Tahir Nas · Examples run in our simulator · Published · Updated

Returns the days part of a duration.

When to use it

Use it to turn the difference between two dates into a whole number of days, for ages, lead times, days open or overdue counts. Subtracting dates gives a duration value; Duration.Days turns it into a number you can sum, filter or band.

Syntax

Duration.Days(duration as nullable duration) as nullable number

Returns

Whole days.

Example

Duration.Days(#date(2026, 3, 9) - #date(2026, 3, 2))

Result

7

Example: days overdue

Subtracting two dates gives a duration; Duration.Days takes its whole days.

Duration.Days(#date(2026, 4, 1) - #date(2026, 3, 15))

Result

17

Both results are produced by the Power Query Exercises simulator, an independent implementation of a documented subset of M, and checked on every build.

Good to know

Common mistakes

The matching command in Excel

Excel for Windows
Add Column > Duration > Days
What you see
A new column holds the whole days of the selected duration column.

Paths are for the Power Query editor in Excel for Microsoft 365, checked against Microsoft's documentation on 8 November 2026: Add a column based on a data type (Power Query) (Microsoft Support).

Exercises that use Duration.Days

Learn more

Related functions

Official documentation: Duration.Days on Microsoft Learn.