Forum Discussion
Dicken
Post Prodigy
1 month agocreate total hours from date time
- 1 month ago
Hi Dicken
try sample mcode
let Source = #table( type table [Task = text, Start = datetime, End = datetime], { {"Task A", #datetime(2026, 10, 1, 9, 0, 0), #datetime(2026, 10, 1, 17, 30, 0)}, {"Task B", #datetime(2026, 10, 1, 22, 0, 0), #datetime(2026, 10, 2, 6, 15, 0)}, {"Task C", #datetime(2026, 10, 2, 8, 0, 0), #datetime(2026, 10, 5, 12, 0, 0)}, {"Task D", #datetime(2026, 10, 3, 14, 45, 0), #datetime(2026, 10, 3, 15, 5, 0)}, {"Task E", #datetime(2026, 10, 4, 10, 0, 0), null} } ), AddTotalHours = Table.AddColumn( Source, "Total Hours", each if [Start] = null or [End] = null then null else Number.Round(Duration.TotalHours([End] - [Start]), 2), type number ) in AddTotalHoursPlease give kudos or mark it as resolved once confirmed.
Regards,
Praful
v-saisrao-msft
Community Support
1 month agoHI Dicken,
Have you had a chance to review the solution shared by ShivekMaharaj pankajnamekar25 Murtaza_Ghafoor Rupa01? If the issue persists, feel free to reply so we can help further.
Thank you.