We’ve extended Inspire Early Bird Pricing until March 1. Register now and enjoy 20% off conference passes and 10% off training passes. P.S. Don’t forget to bring friends! When you sign up for five or more tickets, you get an extra 20% discount on conference passes. Learn more now.
alteryx Community

# Alteryx Designer Desktop Discussions

SOLVED

## date today last year

8 - Asteroid

I am looking out for a solution, to get the below formula to return date for today last year.

For example, date today (Sunday) is 2020-11-15, but date on Sunday last year was 2019-11-17.

DateTimeAdd(DateTimeToday(),+2,"days") will provide an output of 17/11/2020

Is there a way I can get a this date, but in 2019?

5 REPLIES 5
17 - Castor

Hi @novice1,

If you will minus 364 days you will get a result that you are interested in.

20 - Arcturus

Or you can try:

ToString(ToNumber(Left([date field],4))-1) +
Substring([date field],4)

cheers,

mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
16 - Nebula

Hi @novice1 ,

are you looking for the date last year or the same weekday? I think, you need an addition "adjustment", i.e. a difference between weekday this year and weekday last year. I've attached a workflow to calculate using a formula tool "step-by-step".

Let me know if it works for you.

Best,

Roland

8 - Asteroid

Thank you all for your responses.

I have existing formula and used simples of solutions

It is simple and it works, as I already have quite a few formulas running to calculate Year start and year end for 2020 and 2019, Where year end is always last Friday of previous week.

Regards,

Egle

17 - Castor

Hi @novice1,

Thank you for marking my post as a solution.

Good luck!

Labels