Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

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

Create Quarter Field based on Date Field

Adam_B
8 - Asteroid

Hello, 

 

I have a date field, and I would like to create a new column that aligns with the date to reflect the quarter it's in. 

 

Adam_B_0-1683058180856.png

So with the date provided above, the new field would have Q3. 

 

I thought I could do this with the DATETIME tool, however, I cannot. 

 

Please and Thank you!!! as always :)

Adam

4 REPLIES 4
DataNath
17 - Castor
17 - Castor

Hey @Adam_B, just one of those we have to calculate ourselves (at least for now!):

 

DataNath_0-1683058845355.png

 

I did actually create this as a possible output in a macro I created a while ago, though it only prints out the number: https://community.alteryx.com/t5/Community-Gallery/Enhanced-DateTimeTrim/ta-p/972535

Adam_B
8 - Asteroid

@DataNath So I have to enter in the Quarter manually?  Can I establish a range?

 

For Example, 

  If date IN 1/1/2020-3/31/2020 then Q1 or 4/1/2020-6/30/2020 then Q2?

 

Just not sure how to format that formula. 

DataNath
17 - Castor
17 - Castor

Oh no @Adam_B, when I said calculate ourselves I just meant we need to set up a formula. What I've posted above will still dynamically calculate any date's quarter. All the calc is doing is taking the month part of the date as an integer i.e. 5 for May right now, dividing it by 3 and then rounding that up to the next whole number which gives you the quarter. The final ToString() function around the outside just allows you to have the number as text so you can add the 'Q' to it for formatting.

Adam_B
8 - Asteroid

@DataNath Thank you!!!

Labels
Top Solution Authors