Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Show time between the Two Dates

Hi All,

 

I am having one requirement where I need to get the time between two dates. Please find the below sample data. Where I have one column which is "Start Date".

 

     

Let's say we have 24 hours in a day and if we split those 24 hours by 4 hours then 24 hours will be divided 6 times. So in my requirement, for the first start date which is "1-09-2020 12:05:10Am" If I add 4 hours to this date and Time then it should show 

"1-09-2020 04:05:10AM". Please find the below screen shot for the reference of ouput.

So here I want to calculate the difference between dates but before that I need to have After Adding 4 hours Column in my table . If I have that column then we can find the diffrence between the start date and The column which will get "after adding 4 hours".

Could anyone help me, How can I get the "After adding 4 hours column" ?

 

Best Regards,

Srihari

  • hi  Anonymous 

    Just add a new calculate column as below:

    After Adding 4 hours = 'Table'[Start Date] + TIME(4,0,0)

    Result:

     

    Regards,

    Lin

2 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    You can add the TIME function to add 4 hrs in either a calculated column or (recommended) in a measure like this one.  Use this in a table visual with your start date column, replacing AddTime with your actual table name.

     

    Plus 4 hrs = MIN(AddTime[Start Date]) + TIME(4,0,0)
     
    Regards,
    Pat
     
  • v-lili6-msft's avatar
    v-lili6-msft
    Community Support

    hi  Anonymous 

    Just add a new calculate column as below:

    After Adding 4 hours = 'Table'[Start Date] + TIME(4,0,0)

    Result:

     

    Regards,

    Lin