OpenBI Docs Buy

Duration.ToText

Writes a duration as text: days, a point, then hours:minutes:seconds.

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

Syntax

Duration.ToText(duration as nullable duration, optional format as nullable text) as nullable text
ParameterTypeDescription
durationnullable durationThe duration; null gives null.
formatnullable text
optional
OpenBI does not use it: leave it out or pass null.

Returns

nullable text. The duration as text, such as "2.04:30:00".

Remarks

  • The days and the point are left out when there are no whole days; fractions of a second follow with seven decimals. The text does not depend on the culture.
  • For a report, a number of hours (Duration.TotalHours) is often clearer than this text.

Examples

A delivery time

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

Less than a day

Duration.ToText(#duration(0, 0, 45, 0))
"00:45:00"

Duration.FromText, Duration.TotalHours, Text.From.

Last updated · OpenBI Studio 0.3.79