Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Lazar1
Contributor III
Contributor III

How to create countdown timer - repetitive on monthly basis?

Hi everyone,

I want to create a timer that shows each month how much time is left until the 7th of the next month, probably using variables.

So for example if now() = 11/Jul/2023 11:00, until 7th of the next month (07/Aug/2023 00:00) I have 26 days and 13hours  left = 637h and 0 minutes. I want this value to be presented in text or KPI object for example, and to be repetitive each month. So after 7th August, it will count down until 7th September. Basically, the range period is between 7th of the 2 months.

 

Thanks in advance for your help!

Labels (1)
1 Solution

Accepted Solutions
vupen
Partner - Creator
Partner - Creator

Try this as the expressin for the KPI:

Interval(
If(Day(Today(1)) <= 7,MakeDate(Year(AddMonths(Today(1),0)),Num(Month(AddMonths(Today(1),0))),7), MakeDate(Year(AddMonths(Today(1),1)),Num(Month(AddMonths(Today(1),1))),7))
-
Now(1)
,'D hh') & ' D hh'

View solution in original post

4 Replies
vupen
Partner - Creator
Partner - Creator

Try this as the expressin for the KPI:

Interval(
If(Day(Today(1)) <= 7,MakeDate(Year(AddMonths(Today(1),0)),Num(Month(AddMonths(Today(1),0))),7), MakeDate(Year(AddMonths(Today(1),1)),Num(Month(AddMonths(Today(1),1))),7))
-
Now(1)
,'D hh') & ' D hh'

Or
MVP
MVP

AddMonths(MonthStart(Now()),1) + 6 - Now() would get you the time left to the 7th of the next month. 

If you want this to be the nearest 7th of a month (i.e. if today is the fifth, there are two days left), the easiest way is probably to add an if statement:

If(Day(Today() < 7, MakeDate(Year(Now(),Month(Now(),7) - Now(), AddMonths(MonthStart(Now()),1) + 6 - Now())

Lazar1
Contributor III
Contributor III
Author

This formula gives me an error: Month takes 1 parametar

Lazar1
Contributor III
Contributor III
Author

This works fine, thanks!