<!-- https://learnsql.cpetoday.com/functions/m/duration-totaldays -->
# Duration.TotalDays

Language: Power Query M
Category: Duration
Syntax: Duration.TotalDays(duration as nullable duration) as nullable number
Summary: Returns the whole duration as a number of days, including any part of a day as a decimal.
Returns: The total days as a number, or null when the input is null.
Level: Intermediate
Related: Duration.Days, Duration.TotalHours, Duration.Hours, Duration.From, Number.Round

## What it does
Duration.TotalDays returns the full length of a duration as days, with the fraction kept. Duration.Days would show 1 for a day and a half, but Duration.TotalDays shows 1.5. It is the right choice for averages, such as the average days to pay, where dropping the part day would bias the result.
## Syntax and arguments
- duration: a duration value, usually the difference between two datetimes.
## Example
A payables team measures how long each invoice took to pay, from receipt to payment. The average uses the total days so that payments made in the afternoon are not rounded down.

```powerquery
let
    Payments = #table(type table [Invoice = text, Received = datetime, Paid = datetime],
        {{"INV1043", #datetime(2026, 10, 1, 9, 0, 0), #datetime(2026, 10, 31, 9, 0, 0)},
         {"INV1044", #datetime(2026, 10, 1, 9, 0, 0), #datetime(2026, 10, 30, 21, 0, 0)}}),
    Days = Table.AddColumn(Payments, "DaysToPay", each Duration.TotalDays([Paid] - [Received]), type number),
    Average = List.Average(Days[DaysToPay])
in
    Average
```

INV1043 was paid after exactly 30 days. INV1044 was paid after 29.5 days, because it went out at 21:00 on the 30th, half a day earlier. The average of the two is 29.75 days. The whole days function would have shown 30 and 29, and the average would be 29.5.
## Example: a second, different use
Turn a duration of one and a half days into 1.5 for a service level report that states its target in days.
## Things to watch
- The fraction is kept, which is what averages need. Use Duration.Days when the report is in whole days.
- A duration in hours is easier to read for short periods. Use Duration.TotalHours there.
- Round the result for display with Number.Round, not before the average is taken.
- Null in gives null out.
## In business terms
Days to pay, days to collect and cycle times are usually reported as averages. Using the total days keeps those averages accurate, which matters when a metric is set in a contract or a board target.
