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
: Aduration
value from textual elapsed time forms (d.h:m:s). Refer toDuration.FromText
for details.number
: Aduration
equivalent to the number of whole and fractional days expressed byvalue
.
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 )
Related functions
Other functions related to Duration.From are:
