Downloads
Power Query MDurationIntermediate

Duration.TotalDays

Returns the whole duration as a number of days, including any part of a day as a decimal.

Syntax
Duration.TotalDays(duration as nullable duration) as nullable number

Returns: The total days as a number, or null when the input is null.

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

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.

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

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.

Related functions

All Power Query M functions · View as Markdown · M basics