Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
afuhrman
Contributor
Contributor

Count days from today to a fixed date

Hi Everyone,

I'm brand new to Qlik and I've tried everything I can find, but I haven't gotten this to work. I'm trying to calculate the number of days between 'today' and a fixed date. It's basically a countdown. Any and all help is greatly appreciated.

Thanks!

Allison

Labels (1)
5 Replies
rushikale0106
Contributor III
Contributor III

Hi @afuhrman ,

I might have a solution to your query.

We have Date and Time Function NetWorkDays(start_date, end_date). It counts the number of days between the mentioned Start Date and End Date.

I tried the following expression with the Text object.

=NetWorkDays(today(), makedate(2020, 12, 31))

Here, Today() will give you the today's date and it will change daily, whenever you start the tool.

and fixed date, I considered 31st December 2020, so I made the Date with MakeDate() function. It will be a fixed date in this expression.

The result of this expression is 101. Considering Today = 13th August 2020.

Hope this solution helps you with your query. Let me know if you face any issues.

 

Regards,

Rushika

maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi Allison,

 You can use either Interval(Today()- FixedDate,'D') or Floor(Today())-Floor(FixedDate), both will work.

Let me know if not working.

 

Manesh Khot

maneshkhot@gmail.com

afuhrman
Contributor
Contributor
Author

Hi Rushika,

This expression worked perfectly for work days, but we want to include all days, weekends too. I’ve tried a few different functions in place of NetWorkDays, but nothing worked. Do you have an alternate function that would include all days?

Thanks so much for your help!

Allison

afuhrman
Contributor
Contributor
Author

Hi Manesh,

I tried both of these expressions, but it keeps telling me "error in expression" for both. I've tried a few different variations, but I can't get either to work.

Thanks for your help!

Allison

Brett_Bleess
Former Employee
Former Employee

Things are actually quite simple, you need to be sure both values are in dual or integer format and simply subtract them in that case to get the number of days between.  About the best I can offer to try to help further is the following Design Blog post, which also contains two links to related posts at the bottom, hopefully those will get you on the right track with things.

https://community.qlik.com/t5/Qlik-Design-Blog/The-Date-Function/ba-p/1463157

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.