Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to create a day by time

Hi all,

I have one scenario .

Daily collections by centers (daily summary from previous day 5PM to today 5PM).

For example 10-04-2018 : 5PM to 11-04-2018 5PM is 11-04-2018 .

And also if it is sunday, 5PM to 1PM.


This is our day calcluation.How can i write the script to get this scenario.Can anyone help me.


Thanks.




1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

The Daystart() function comes in very handy as you can calculate a new date which has an offset from the given date.

LOAD

   RegisteredDate,

   Value,

   DayStart( RegisteredDate , 0 , -7/24 ) AS SummaryDate

....

Then you can do your sums according to SummaryDate later in the load script or in a sheet in the application.

When it comes to Sundays - does it really matter that the day ends at 1PM? Will you have values occuring between 1PM and 5PM anyway? If you do how would you consider these values - where would they belong when it comes to a SummaryDate?

View solution in original post

3 Replies
pmbalamca
Partner - Contributor
Partner - Contributor

Try this,

timestamp(time_H+0.25) as time

petter
Partner - Champion III
Partner - Champion III

The Daystart() function comes in very handy as you can calculate a new date which has an offset from the given date.

LOAD

   RegisteredDate,

   Value,

   DayStart( RegisteredDate , 0 , -7/24 ) AS SummaryDate

....

Then you can do your sums according to SummaryDate later in the load script or in a sheet in the application.

When it comes to Sundays - does it really matter that the day ends at 1PM? Will you have values occuring between 1PM and 5PM anyway? If you do how would you consider these values - where would they belong when it comes to a SummaryDate?

Anonymous
Not applicable
Author

Thanks a million.

and yes I will have values b/w 1PM and 5PM