Qlik Community

Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

Not applicable

How to set start and End Date?

My objective is to assign a variable with start date which is equal to the date on which the report is generated.(basically it should take the system date as the start date on the day of generation)

Likewise another variable is to be assigned which is the end date that is two weeks before the start date.

I did try the following command:

Let StartDate = Input('Enter Start Date (MM/DD/YYYY)' , 'Input required'); But here I had to feed the date manually which I dont wan't. The Qlikview script should take the system date automatically.

The End Date should be set accordingly. (eg something like Let vEndDate = VStartDate - 14 days)

Can anybody please help me out? Thanks in advance!!!!

8 Replies

Re: How to set start and End Date?

Maybe with:

Let StartDate = date(today(), 'MM/DD/YYYY');

Let EndDate = date($(StartDate) - 14, , 'MM/DD/YYYY')

- Marcus

Not applicable

Re: How to set start and End Date?

Hi Marcus,

Something wrong with the syntax.

It's not working out.

The date is in the format of DD-MM-YYYY

Thanks and regards,

Arghya

Re: How to set start and End Date?

Then try this:

Let StartDate = date(today(), 'DD-MM-YYYY');

Let EndDate = date($(StartDate) - 14, , 'DD-MM-YYYY')

- Marcus

Not applicable

Re: How to set start and End Date?

Still not working out.

It is capturing the start date perfectly as today's date 28-02-2017

but there is an error with the end date. The end date what it shows is 04-07-1894.

Can you please figure it out why is this happening.

Re: How to set start and End Date?

Of course the single-quotes around the variable are missing and there are other typos like an additional comma - therefore try:

Let EndDate = date('$(StartDate)' - 14, 'DD-MM-YYYY');

- Marcus

aarkay29
Valued Contributor

Re: How to set start and End Date?

may be this:

Let StartDate = date(today(), 'DD-MM-YYYY');

Let EndDate = date(today()- 14 ,'DD-MM-YYYY');

Not applicable

Re: How to set start and End Date?

Thanks Marcus,

The problem is solved.

Not applicable

Re: How to set start and End Date?

Thanks to you also Aar Kay for helping me out of my problem.

Thanks,

Arghya

Community Browser