Duration.Hours

Updated on

Duration.Hours is a Power Query M function that extracts the hours portion of a duration value. The function returns an integer representing the number of hours.

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

Syntax

Duration.Hours( duration as nullable duration ) as nullable number

Description

Duration.Hours returns the hours portion (0-23) of the specified duration duration.

Examples

Extract the hours from a duration value.

// Output: 4
Duration.Hours( #duration( 5, 4, 3, 2 ) )

Other functions related to Duration.Hours are:

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