
Not applicable
2016-02-18
07:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!!
1,487 Views
2 Replies

Partner Ambassador/MVP
2016-02-18
12:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Use Addyears function.
Addyears(Date,-10)
Regards,
Kaushik Solanki
Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
1,384 Views

MVP
2016-02-18
01:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
1,384 Views
