Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
learner03
Post Partisan
Post Partisan

Difference of start and end time in difference column (result in hours)

How can I get difference of start and end time in Difference Column-

I want the result in Hours as whole number as I need to create measure afterwards to sum the hours.

akapoor03_0-1626932304244.png

 

2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@learner03 

=Hour (Endtime-starttime)

OR

=(endtime-starttime)*24





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Vera_33
Resident Rockstar
Resident Rockstar

Hi @learner03 

 

If you consider decimal number, one way in M

Vera_33_0-1626934036218.png

Duration.TotalHours([End Time]-[Start Time])

and another way in DAX

Vera_33_1-1626934109454.png

DATEDIFF([Start Time],[End Time],MINUTE)/60

 

 

View solution in original post

6 REPLIES 6
Vera_33
Resident Rockstar
Resident Rockstar

Hi @learner03 

 

If you consider decimal number, one way in M

Vera_33_0-1626934036218.png

Duration.TotalHours([End Time]-[Start Time])

and another way in DAX

Vera_33_1-1626934109454.png

DATEDIFF([Start Time],[End Time],MINUTE)/60

 

 

ryan_mayu
Super User
Super User

@learner03 

=Hour (Endtime-starttime)

OR

=(endtime-starttime)*24





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




This is given me below output-

akapoor03_0-1626934388321.png

 

you can change the data type to whole number





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




perfect.Thanks

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.