Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Date time quarter end expressions

cireost
8 - Asteroid

Hi - I have a date 12-11-2017.  What would the expression be to return the start and end of the quarter?  I am primarily focused on getting the quarter end for any given date, but could see having the beginning helpful too.  Thanks!

 

Input:

12-11-2017

 

Output: 

Start: 10/1/2017

End: 12/31/2017

 

3 REPLIES 3
jdunkerley79
ACE Emeritus
ACE Emeritus

Assuming you have the date as an Alteryx date I suggest:

 

Start of Quarter:

Left([Parsed],5) +
PadLeft(ToString(Ceil(DateTimeMonth([Parsed])/3)*3-2),2, '0')
+ '-01'

 

End of Quarter:

DateTimeTrim(Left([Parsed],5) +
PadLeft(ToString(Ceil(DateTimeMonth([Parsed])/3)*3),2, '0')
+ '-01', "lastofmonth")

 

Sample attached

 

cireost
8 - Asteroid

awesome. thank you!

 

to follow up with an add on question, do you know if there is a way to calculate the # of days in a quarter?

 

so if its 3/31, 6/30,etc. - is there an expression to calculate how many days are in that quarter?

 

thanks!

estherb47
15 - Aurora
15 - Aurora

Hi @cireost 

 

Yes! The DateTimeDiff function can tell you the number of days between two dates

DateTimeDiff(Later date, earlier date, "days")

 

Let me know if that helps.

 

Cheers!

Esther

Labels
Top Solution Authors