cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
akapoor03
Helper V
Helper V

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

@akapoor03 

=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
Super User
Super User

Hi @akapoor03 

 

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
Super User
Super User

Hi @akapoor03 

 

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

@akapoor03 

=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
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through June10th!

Power BI Dev Camp Session 22 without aka link and time 768x460.jpg

Check it Out!

Watch Session 22 Ted's Dev Camp along with past sessions!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!

Top Kudoed Authors