9 Replies Latest reply on May 26, 2017 6:49 AM by Shinichiro Murakami

# Time difference

Hello all,

I want to see the sales, when time is between 13 hrs to 16:30 hrs. So how calculation can be return ?

• ###### 1. Re: Time difference

Hi,  Asif

you can create a calculation field as below to count the sales.

IF DATEPART('hour',[Order Date]) >= 13 and

( DATEPART('hour',[Order Date]) < 16 or

(DATEPART('hour',[Order Date] )< 17 and DATEPART('minute',[Order Date]) <=30))

then

[Sales]

END

Hope this could help

ZZ

• ###### 2. Re: Time difference

Your data or sample data ?

Do you want it in a calculated field or simply filtered ?

• ###### 3. Re: Time difference
 AIMS Upload Date LOGIN COMPLETION DATE 14-03-2017 13:00 14-03-2017 15:00 15-03-2017 12:23 15-03-2017 15:41 22-03-2017 06:37 22-03-2017 16:35 25-03-2017 13:54 27-03-2017 11:12 13-04-2017 12:23 13-04-2017 16:07 21-04-2017 19:52 22-04-2017 17:41
• ###### 4. Re: Time difference

Yes i it need in calculation field..

• ###### 5. Re: Time difference

Hello Zang,

I need it between 13 hrs to 16:30 hrs. how OR will help here??

Thanks,

• ###### 6. Re: Time difference

Hi Asif

Little bit simplified one.

Converted string to datetime.

% means modulo and this brings hours from 12:00 am.

Thanks,

Shin

1 of 1 people found this helpful
• ###### 7. Re: Time difference

Hi, Asif

Please see my explaination below, hope this could help.

IF     DATEPART('hour',[Order Date]) >= 13 // hour needs equal or greater than 13, first condition

AND // below are the second condition

(     DATEPART('hour',[Order Date]) < 16  // hour less than 16, included

Or // if hour equal to 16, then look at the minutes whether it is less than 30

(DATEPART('hour',[Order Date] )< 17 and DATEPART('minute',[Order Date]) <=30)

)

then

[Sales]

END

ZZ