Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
KJM
Contributor III
Contributor III

Live Countdown to Variable Date

Hi there,

In the attached sample app, we have a successful countdown to a variable date.  However, the time only amends each time an interaction happens such as clicking on a bar in a bar chart.  Is there any way I can make this Countdown continuously count down?  At the moment what we've done is created two variables in the front end. 

vTargetDate is defined as:

= MakeDate(2025, 01, 18) + MakeTime(00, 00, 00)

vCountdown is defined as:

Interval(vTargetDate - Now(), 'D "Days" hh "Hrs" mm "Min" ss "Secs"')

Thus $(vCountdown) is then the expression within a KPI.  As I say, this works OK but it just doesn't Countdown unless an interaction happens.  Can this be continuous?  Sample attached.

Thanks,

K.

Labels (2)
3 Replies
Qrishna
Master
Master

I cannot open your qvf but i understood what you are going thru with expression.

I see you storing the countdown expression in a variable and you are using $(Countdown) in KPI.

In the KPI, Try write the entire expression instead of using $(Countdown).

for some reason Interval(vTargetDate - Now(), 'D "Days" hh "Hrs" mm "Min" ss "Secs"') is showing me 66 "66a059" 09 "9r59" 17 "0in" 59 "59ec59". if its working for you its well n good.
i formatted for myself and i was able to see the countdown.

vTargetDate : Timestamp(MakeDate(2025, 1, 18) + MakeTime(0, 0, 0))

in the KPI box, use this expression as is (dont use $(Countdown)):
= Num(Floor(Timestamp(MakeDate(2025, 1, 18) + MakeTime(0, 0, 0)) - Now())) & ' Days ' &
Time(Frac(Timestamp(MakeDate(2025, 1, 18) + MakeTime(0, 0, 0)) - Now()), 'hh') & ' Hrs ' &
Time(Frac(Timestamp(MakeDate(2025, 1, 18) + MakeTime(0, 0, 0)) - Now()), 'mm') & ' Min ' &
Time(Frac(Timestamp(MakeDate(2025, 1, 18) + MakeTime(0, 0, 0)) - Now()), 'ss') & ' Secs'

//=Interval(Timestamp(MakeDate(2025, 1, 18) + MakeTime(0, 0, 0)) - Now(), 'D "Days" hh "Hrs" mm "Min" ss "Secs"')

for me, the below expression strored in a variable vCountDown is working fine ($(vCountDown) in KPi)
Num(Floor(Timestamp(MakeDate(2025, 1, 18) + MakeTime(0, 0, 0)) - Now())) & ' Days ' &
Time(Frac(Timestamp(MakeDate(2025, 1, 18) + MakeTime(0, 0, 0)) - Now()), 'hh') & ' Hrs ' &
Time(Frac(Timestamp(MakeDate(2025, 1, 18) + MakeTime(0, 0, 0)) - Now()), 'mm') & ' Min ' &
Time(Frac(Timestamp(MakeDate(2025, 1, 18) + MakeTime(0, 0, 0)) - Now()), 'ss') & ' Secs'

 

2492306 - Live Countdown to Variable Date.PNG

KJM
Contributor III
Contributor III
Author

Thanks for the reply Qrishna,

Using your expression rather than the variable is working the same way the variable did.  So it is showing an accurate time for a moment in time but doesn't count down live and only changes when an interaction is made such as selecting. 

Qrishna
Master
Master

Not sure how your app is designed,  usually when you have any expression with now() in it, its dynamically calculated afaik unless something is blocking the expression calculation.