Duration.ToRecord is a Power Query M function that converts a duration value to a record. The function returns a record containing the parts of the duration value.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Duration.ToRecord( duration as duration ) as record
Description
The Duration.ToRecord function breaks down a duration value into its individual parts and returns them as a record.
Examples
When working with durations, it can be useful to break them down into their component parts: days, hours, minutes, and seconds. This can be done using the Duration.ToRecord function. Let’s explore how this function works.
Example Duration Value
Consider the following duration value:
#duration( 10, 5, 3, 20 )
This value represents 10 days, 5 hours, 3 minutes, and 20 seconds.
Converting Duration to Record
To break down this duration into smaller parts, you can use the Duration.ToRecord function. Here’s how you can do it:
let
myDuration = #duration( 10, 5, 3, 20 ),
toRecord = Duration.ToRecord( myDuration )
in
toRecord
The output of this expression is a record value with four fields: Days, Hours, Minutes, and Seconds. This allows you to access each component of the duration separately.

Creating a Record Manually
If you wanted to create such a record manually you would do so by specifying each field:
[
Days = 10,
Hours = 5,
Minutes = 3,
Seconds = 20
]
Related functions
Other functions related to Duration.ToRecord are:
2023-2026 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy