Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Current hour

Hi, how do I display a current hour in a textbox? like displaying a current dat using =Today()

1 Solution

Accepted Solutions
Jason_Michaelides
Luminary Alumni
Luminary Alumni

I think you're over-complicating it a bit!  See attached which uses a variable vFiltertime to define the minimum datetime.  The chart expression then uses this in set analysis rather than using IF statements in a dimension.

Hope this helps,

Jason

View solution in original post

5 Replies
nilesh_gangurde
Partner - Specialist
Partner - Specialist

Use the Now() Function in text object .

=Now()

Or

=Time(Now())

Regards,

Nilesh Gangurde

Not applicable
Author

Hi Nilesh

I am struggling to get what I needed going, Can you please help me with this, I want to display in a table everything that happen in the past hour from now, please see the file attached.

Regards Edzi

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Here's an answer BUT make sure you heed the warnings on use of Now() !!

Now()-(1/24) will give you the current time minus an hour so your dimension variable could be:

If(Yourtimestamp>=(Now()-(1/24),Test_Name)

This should work, but Now() will poll the operating system every second to get the current time. With large data sets dependent upon the result of Now() and with many users you could significantly impact server performance.  Could you not use Now(0) instead?  This will use the datetime the script was last run and would not impact the server in the same way.

Hope this helps,

Jason

Not applicable
Author

Hi Jason

I have used the code below but still it doesn’t give return data for the past our, Please help.

IF(text(date(Test_Date1,'YYYY/MM/DD')) = Date(Today(), 'YYYY/MM/DD') and hour(Test_Date1) >= (Now()-(1/24)),Test_Name)

Regards

Edzi

Jason_Michaelides
Luminary Alumni
Luminary Alumni

I think you're over-complicating it a bit!  See attached which uses a variable vFiltertime to define the minimum datetime.  The chart expression then uses this in set analysis rather than using IF statements in a dimension.

Hope this helps,

Jason