Updated on

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


Duration.ToRecord( duration as duration ) as record


The Duration.ToRecord function breaks down a duration value into its individual parts and returns them as a record.


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:

  myDuration = #duration( 10, 5, 3, 20 ),
  toRecord = Duration.ToRecord( myDuration  )

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.

Duration.ToRecord splits a duration into record fields in Power Query

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

Other functions related to Duration.ToRecord are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/duration-torecord