9 Replies Latest reply: Aug 30, 2016 12:45 AM by Adam Brian

# 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,

• ###### Re: Subtract a day from a set of time

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

• ###### Re: Subtract a day from a set of time

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.

• ###### Re: Subtract a day from a set of time

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)

• ###### Re: Subtract a day from a set of time

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.

• ###### Re: Subtract a day from a set of time

Hi,

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

probably you have missed the equals sign and changed brackets.

Elena

• ###### Re: Subtract a day from a set of time

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

Thanks,

Ram Krishna

• ###### Re: Subtract a day from a set of time

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?

• ###### Re: Subtract a day from a set of time

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

• ###### Re: Subtract a day from a set of time

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?