Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Formula to faciliate the current quarter in YYYYMM format

Khristian_Evans
8 - Asteroid

Hi is there a formula I can enter to output the current quarter the workflow is ran in? I know how to convert to YYYYMM format. Thanks in advance for the help! 

5 REPLIES 5
abacon
12 - Quasar

@Khristian_Evans Here is one way to do it. All I did was created a formula that checked which quarter today's date is in.

if between(DateTimeToday(),tostring(DateTimeYear(DateTimeToday())) + '-01' + '-01',tostring(DateTimeYear(DateTimeToday())) + '-03' + '-31') then 'Q1'
elseif between(DateTimeToday(),tostring(DateTimeYear(DateTimeToday())) + '-04' + '-01',tostring(DateTimeYear(DateTimeToday())) + '-06' + '-30') then 'Q2'
elseif between(DateTimeToday(),tostring(DateTimeYear(DateTimeToday())) + '-07' + '-01',tostring(DateTimeYear(DateTimeToday())) + '-09' + '-30') then 'Q3'
else 'Q4'
endif

 

Bacon

binuacs
21 - Polaris

@Khristian_Evans one more option 

image.png

abacon
12 - Quasar

@binuacs Forgot about that one, much easier.

Khristian_Evans
8 - Asteroid

This is good! But I'm looking for an output like '202502' for quarter 2 - I also don't have any previous input data with a date. Want to create a formula that can pick up today's date (or the date it was ran) and create an output of '202502' which is Q2. It has to be in this format for upload to site. 

abacon
12 - Quasar

@Khristian_Evans Use the DateTimeNow tool in the In/Out section, this will create record that is todays date. Then do the following formula.

 

tostring(DateTimeYear([DateTimeNow])) + "0" + ToString(CEIL(DateTimeMonth([DateTimeNow]) / 3))

 

image.png

Labels
Top Solution Authors