Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Change Today() to a different date

I created a dashboard for a client using stale data.  Many of the charts and calculations are based off of comparing Shipping and Ordering dates to the current date...today().  Is it possible to manipulate or change the date associated to today().

Thanks for you help.

1 Solution

Accepted Solutions
MVP
MVP

Re: Change Today() to a different date

Hi,

Create a variable like below

vDate = Date(Today() - N)    ///(N may be any number you want to adjust)

Now use this variable wherever you are using Today(), this way you can in one place and it reflects in multiple places.

Today() will always return the system date of your computer, if you want to change value of it you have to change date in your computer..

Hope this helps you.

Regards,

Jagan.

7 Replies
Not applicable

Re: Change Today() to a different date

hi jeremy

can you please explain what you want to do with an example

thabang_petje
Contributor III

Re: Change Today() to a different date

Hi,

you can try Date(Date(today(), 'DD/MM/YYYY')+<Number of days to add>, 'DD/MM/YYYY').


The above just adds the number to today. So if I have +14, this will add 14 days to today. ​You can also subtract this

MVP
MVP

Re: Change Today() to a different date

Hi,

Create a variable like below

vDate = Date(Today() - N)    ///(N may be any number you want to adjust)

Now use this variable wherever you are using Today(), this way you can in one place and it reflects in multiple places.

Today() will always return the system date of your computer, if you want to change value of it you have to change date in your computer..

Hope this helps you.

Regards,

Jagan.

hirishv7
Honored Contributor

Re: Change Today() to a different date

Hi,

Can you explain a bit more please with some sample if possible,

-Hirish

Not applicable

Re: Change Today() to a different date

Not applicable

Re: Change Today() to a different date

Jagan,

Thanks.  Yea I should have created a variable at the beginning of development and then performed all calculations based off of the variable.  The problem is I already coded everything based off of using today(). 

Yea i was just hoping that there was some way i would be able to alter the date associated to today() so i wouldnt have to go back and change all of my expressions. 

In regards to others who are asking what i'm trying to do with an example.  I performing different calculations in the dashboard based on todays date.  The problem is i'm working with stale data and need to change the date associated to today to let say 5/5/15.  That way aging of Orders and Shipments display correctly.  Appreciate the feedback.  Thanks.

Not applicable

Re: Change Today() to a different date

You can create your own today date value based on your data. Get the Max date from your data and assign the value to your custom defined value.

vCustomToday -->  =Max({1} DateField)

Community Browser