Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

How to get date 10 years older to the current date

Hello All,

Struggling with an issue which i thought would be rather simple.

I would need to do an bring up some data from SQL based on dates and the difference btwn them should be exactly 10 years.

Ex: If any user opens the app today they should be able to see date ranging from 2/18/2006 to 2/18/2016.

TIA!!

2 Replies

Re: How to get date 10 years older to the current date

Hi,

Use Addyears function.

Addyears(Date,-10)

Regards,

Kaushik Solanki

Re: How to get date 10 years older to the current date

May be set a variable like this:

MaxDate:

LOAD Date(AddYears(Max(Date), 10), 'DD-MMM-YYYY') as MaxDate,

          Date(Max(Date), 'DD-MMM-YYYY') as MinDate

Resident YourFactTable;

LET vMaxDate = Peek('MaxDate);

LET vMinDate = Peel('MinDate');


DROP Table MaxDate;

SQL

SELECT *

FROM Table

Where DateField >= $(vMinDate) and DateField <= $(vMaxDate);

Community Browser