Duration.Hours Function of Power Query

The Duration.Hours function in Power Query, returns the hours portion of a duration.

Syntax

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

• duration: The input, which must be a duration type (e.g., created with #duration(days, hours, minutes, seconds)).

Returns: It returns the integer number of hours from the duration.

Example: Extract the hours from a duration value.

Power Query M

let
    source = Duration.Hours(#duration(1, 2, 30, 0))
in
    source 

The output of the above code is 2.