Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Generate Prior quarter dates

Mario36
8 - Asteroid

Hi All,

 

Suppose I have a date as 2022-12-31. I would want the below data. Kindly help.

Quarter DateQuarterQuarter Start DateYearYear Start
2022-12-31Q4 20222022-10-0120222022-01-01
2022-09-30Q3 20222022-07-0120222022-01-01
2022-06-30Q2 20222022-04-0120222022-01-01
2022-03-31Q1 20222022-01-0120222022-01-01
2021-12-31Q4 20212021-10-0120212021-01-01
2021-09-30Q3 20212021-07-0120212021-01-01
5 REPLIES 5
DataNath
17 - Castor

Hey @Mario36, I built a macro a good while ago that got me most of the way there - just needed to add a couple modifications & the Year field!

 

https://community.alteryx.com/t5/Community-Gallery/Enhanced-DateTimeTrim/ta-p/972535

 

DataNath_0-1679326725730.png

 

I've attached a packaged workflow that contains the macro - feel free to open it up and see the calculations etc behind the various dates on offer.

Mario36
8 - Asteroid

Hi @DataNath ,

Thank you. but what I was looking for was to generate rows from just a date such as  2022-12-31

DataNath
17 - Castor

Apologies @Mario36, didn't mention actually generating all of the rows. If you start with a single date like this:

 

DataNath_0-1679327437830.png

 

You can constantly generate one quarter ago like so, where you would just replace '2021-09-30' with however far back you want to go:

 

DataNath_1-1679327485273.png

 

The only thing with DateTimeAdd() is that - when using 'month' - this isn't handled in the way we like to think about months i.e. if we're on the 30th and tell Alteryx to go back a month, if the month prior has 31 days, it won't automatically jump to that as the 'end of the month', it'll just literally take away one month to the 30th. Therefore, we can standardise everything to the month end with DateTimeTrim():

 

DataNath_2-1679327593232.png

 

The rest of the workflow is then the same as outlined above.

Mario36
8 - Asteroid

You are a life saver. Thank You so much

Q1
5 - Atom

Hey I have a similar project im working on but I need to be able to automate the generation of dates  the past 7 quarter ends, and future dates, how would I do that ? 

Q1_0-1680555495434.png

Q1_1-1680555545946.png

 

Labels