#duration Function of Power Query
The #duration function in Power Query is used to generate a duration value by specifying the number of days, hours, minutes, and seconds.
Syntax
#duration(
days as number,
hours as number,
minutes as number,
seconds as number
) as duration The function takes the following numeric parameters:
- Days: The number of days in the duration.
- Hours: The number of hours, ranging from 0 to 23.
- Minutes: The number of minutes, ranging from 0 to 59.
- Seconds: The number of seconds, which can include decimals for fractions of a second.
Example: Let’s get the duration value and add it to the date.
Power Query M
let
start_date = #date(2025, 3, 31),
duration = #duration(2, 0, 0, 0),
end_date = start_date + duration
in
end_date The output of the above code is 02-04-2025.