Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

sindhu_ibizcs
Contributor

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
MVP
MVP

Re: How to create a day by time

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?

3 Replies
pmbalamca
New Contributor

Re: How to create a day by time

Try this,

timestamp(time_H+0.25) as time

MVP
MVP

Re: How to create a day by time

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?

sindhu_ibizcs
Contributor

Re: How to create a day by time

Thanks a million.

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

Community Browser