Duration.From

Duration.From is a Power Query M function that converts a given value to a duration value. The function returns a duration value or null if the input value is null.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Duration.From( value as any ) as nullable duration

Description

Returns a duration value from the given value. If the given value is null, Duration.From returns null. If the given value is duration, value is returned. Values of the following types can be converted to a duration value:

  • text: A duration value from textual elapsed time forms (d.h:m:s). Refer to Duration.FromText for details.
  • number: A duration equivalent to the number of whole and fractional days expressed by value.
If value is of any other type, an error is returned.

Examples

Convert 2.525 into a duration value.

// Output: #duration( 2, 12, 36, 0 )
Duration.From( 2.525 )

Other functions related to Duration.From are:

BI Gorilla Blog

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/duration-from
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.