Start Free Trial

Alteryx Designer Desktop Discussions

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

categorize base on a range of days

TiffanyH12
7 - Meteor

Hi! I'm trying to take a list of dates and bucket them into the correct quarter, then have a column that says which quarter that line item is apart of. The dates in my data set at formatted as : 2020-07-23

The ranges: 

Q1: 2019-10-28 to 2020-01-26

Q2: 2020-01-27 to 2020-04-26

Q3: 2020-04-27 to 2020-07-26

Q4 2020-07-27 to 2020-10-25

 

essentially, what I want my output to look like:

 

DateQuarter
2020-01-01Q1
2019-12-04Q1
2020-05-29Q3
2020-03-14Q2
3 REPLIES 3
DavidP
17 - Castor
17 - Castor

Since your quarter start and end dates are very specific dates, you'll have to use an if elseif statement like

 

if [date]>='2019-10-28' AND date<='2020-01-26' then 'Q1'

elseif [date]>='2020-01-27' AND date<='2020-04-26' then 'Q2'

elseif [date]>='2020-04-27' AND date<='2020-07-26' then 'Q3'

elseif [date]>='2020-07-27' AND date<='2020-10-25' then 'Q4'

else '' endif

Thableaus
17 - Castor
17 - Castor

Hi @TiffanyH12 

 

Here's a way of doing. WF attached.

 

Cheers,

TiffanyH12
7 - Meteor

Thanks, I copied your formula and was able to get what I need. Tried the statement previously and it wouldn't give me what I wanted...not sure why. Thanks again!

Labels
Top Solution Authors