OpenBI Docs Buy

Duration.From

Turns a value into a duration: a number is read as days, text as days, hours, minutes and seconds.

Group: Dates and times. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Duration.From(value as any) as nullable duration
ParameterTypeDescription
valueanyA duration, a number of days or text; null gives null.

Returns

nullable duration. The duration.

Remarks

  • A number is a count of days, so 0.25 is six hours. Divide first when a number counts hours or minutes: Duration.From(90 / 1440) is 90 minutes.
  • Text is read as Duration.FromText reads it.

Examples

A day and a half

Duration.From(1.5)
#duration(1, 12, 0, 0)

90 minutes from a number of minutes

Duration.From(90 / 1440)
#duration(0, 1, 30, 0)

Text

Duration.From("2.04:30:00")
#duration(2, 4, 30, 0)

Duration.FromText, #duration, Duration.TotalDays.

Last updated · OpenBI Studio 0.3.79