Duration.TotalSeconds Function of Power Query
The Duration.TotalSeconds function in Power Query, returns the total number of seconds from a duration value.
Syntax
Duration.TotalSeconds(duration as nullable duration) as nullable number
• duration: A duration type input (e.g., from #duration(days, hours, minutes, seconds)).
Returns: It represents the total seconds as a decimal.
Example: Find the total seconds spanned by a duration value.
Power Query M
let source = Duration.TotalSeconds(#duration(1, 2, 30, 10)) in source
The output of the above code is 95410.
Calculation Converts the entire duration into seconds:
• 1 day = 1×24×60×60=86,400 seconds
• 2 hours = 2×60×60=7,200 seconds
• 30 minutes = 30×60=1,800 seconds
• 10 seconds = 10 seconds
Total = 86,400+ 7,200 + 1,800 + 10 = 95,410 seconds