Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
IMPORTANT: Upcoming LEF Database Maintenance, Oct. 3rd - SEE DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Subtract a day from a set of time

Hello,

I am trying to display total account register from today 8.00 AM to  yesterday 8.00 AM and i want to find out people registered from beginning of the day to today 8.00 AM.

Can anyone help me with the code to subtract one day from 8.00 AM today?

Thanks,

Adam

1 Solution

Accepted Solutions
Highlighted
Contributor III
Contributor III

Hi Adam,

The function to get today 8 AM is =TimeStamp(Today() + 0.3333334), where numeric part is  actually 8 AM.

Then to get yesterday 8 AM you can use =Timestamp(Today() - 1 + 0.3333334).

HIH

Elena

View solution in original post

9 Replies
Highlighted
Contributor III
Contributor III

Hi Adam,

The function to get today 8 AM is =TimeStamp(Today() + 0.3333334), where numeric part is  actually 8 AM.

Then to get yesterday 8 AM you can use =Timestamp(Today() - 1 + 0.3333334).

HIH

Elena

View solution in original post

Highlighted
Creator III
Creator III

Hi,

Try like this

=Ceil(Interval(Date#('4/16/2013 12:00:00', 'MM/DD/YYYY hh:mm:ss') - Date#('4/11/2013 12:40:32', 'MM/DD/YYYY hh:mm:ss'), 'DD' ))

Hope this helps you.

Highlighted
MVP
MVP

to subtract one day you can add

-1  to your field (1 in Qlik is one day)

for example

first line is today at 8:00 AM

second is yesterday at 8:00 AM (just added -1)

1.png

Highlighted
Creator II
Creator II

Hi Adam,

Use expression like Timestamp(Today()-1) for previous date.

Thanks,

Ram Krishna

Highlighted
Contributor III
Contributor III

Hi,

Thanks for your quick response. The solution works for me. I got another question, how to count the number of registered user from specific date?

Highlighted
Contributor III
Contributor III

It depends on the model you have.
but in common you can try:

Count({$<TimeOfRegistration={">=$(=Timestamp(Today() - 1 + 0.3333334))<=$(=Timestamp(Today() + 0.3333334))"}>}

RegistrationID)

This means that you check whether the time of registration is in the interval of yesterday 8 am and today 8 am. If the answer is positive - the counter increments, if negative - nothing happens.

Elena

Highlighted
Contributor III
Contributor III

Hi,

How can I count:

1. Total account register from before 24/08/2016 until date 24/08/2016 08:00 am?

Can you help me to create function this one. I tried    Count({<Date= {"<=$[timestamp(today() + 8/24-1)]"}>} Status), but didn't help.

Highlighted
Contributor III
Contributor III

Hi,

Count({Date={"<=$(=timestamp(today() + 8/24-1))"}>} Status)

probably you have missed the equals sign and changed brackets.

Elena

Highlighted
Contributor III
Contributor III

Hi all,

Can I ask one more question? I want to set everyday start from 8am not 12am.. For example when i click today, it will show from 8am, not from 12 am. Where can I set the time? anyone can help me to solve this one?