Power Query M code
let
Source = YourTable,
AddedDuration = Table.AddColumn(Source, "DurationHours", each Duration.TotalHours([EndTime] - [StartTime]), type number)
in
AddedDuration
Converts a Duration value, like the difference between two datetimes, into a decimal number of hours.
let
Source = YourTable,
AddedDuration = Table.AddColumn(Source, "DurationHours", each Duration.TotalHours([EndTime] - [StartTime]), type number)
in
AddedDuration
Use Duration.TotalMinutes or Duration.TotalDays instead if you need a different unit.
Browse all 145 snippets in the Power Query M Code Snippets, or search the library for something similar to Convert a Duration to Total Hours.