Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Formula to return Quarter based on a select Date

EYU07
7 - Meteor

I'm trying to do some periodic comparisons and I'm struggling to come up with a formula to return the appropriate designation for "Quarters".  My current formula is below, but given the data in the screenshot, I want to show Jan, Feb, and Mar months as "Prior" when I'm current in Q3, and then when we move to Q4, Apr/May/Jun will become "Prior", "Jul/Aug/Sept" will become "Last", "Oct/Nov/Dec" will become "Current", and "Jan/Feb/Mar" will become "Next".  I'm a bit skeptical whether the "Next" logic will work as I intended but it's the best I could come up with.  I'm all ears if there is another solid solution.  Thank you in advance!

 

Month Formula

if [End Date] = "2020-08-31" then "Current"
elseif [End Date] = datetimeformat(datetimeadd("2020-08-31",-1,"months"),"%Y-%m-%d") then "Last"
elseif DateTimeMonth([End Date]) > DateTimeMonth("2020-08-31") then "Next"
else "Prior" endif

 

Quarter Formula:

if [Quarter#] = "Q" +ToString(CEIL(DateTimeMonth("2020-08-31")/3)) then "Current"

elseif [Month] = "Next" then "Next"

else "Last" endif

2 REPLIES 2
vizAlter
12 - Quasar

Hi @EYU07 — Hope attached the solution will be helpful, if not let me know.

 

vizAlter_1-1599899974784.png

 

@jdunkerley79 has written brilliant expressions for Quarter calculations (Link)!

 

If it resolves your query please mark it "Solved" or "Solved" with a Like. This will help other users find the same answer/resolution.  Thank you.

 

EYU07
7 - Meteor

Thank you so much, it worked! 

Labels