Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Date format to Quarter

ntelyuk
5 - Atom

I have a question is there an easy way or an add-on to Alteryx that will automatically convert the data format 2017-01-01 into 2017 Q1 ? How can I figure this out without a bunch of weird codes? Thanks.

 

 

20 REPLIES 20
pdoppalapudi
5 - Atom

Worked well. ThankQ

dniedrauer
6 - Meteoroid

If you want to make it numerical and sortable, this is what I did: 

 

tostring(DateTimeYear([Year_Month])) + tostring(
(if DateTimeMonth([Year_Month]) in (1,2,3) then 1
elseif DateTimeMonth([Year_Month]) in (4,5,6) then 2
elseif DateTimeMonth([Year_Month]) in (7,8,9) then 3
elseif DateTimeMonth([Year_Month]) in (10,11,12) then 4
else Null() endif))

agcamig
5 - Atom

hello, to make this formula work, what should be the data format of the output? thanks!

David_Doyle
7 - Meteor

Thank you! This worked like a champ!

Brian_Foody
6 - Meteoroid

My date is a vw-string type in the format year & month:

  • 2020-11
  • 2020-10 
  • 2021-02

I need to convert to quarters & years:

  • Q4 2020
  • Q1 2021 

etc.  

 

Is there a formula I can use ?

David_Doyle
7 - Meteor

Take a look at the below solution. I used this and modified it to meet your needs. Not sure if that helps because Your output would still not read as a date if you were doing time series analysis.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Date-format-to-Quarter/td-p/57291

Brian_Foody
6 - Meteoroid

Thanks David - works perfectly !

CaseyMorter
5 - Atom

Thanks @KaneG

Nifty formula!

 

I made this to get the end of the previous quarter.

Feels a little long winded, but works nicely.

Pro-tips appreciated 🙂

 

CaseyMorter_0-1638221748289.png

 

DateTimeTrim(
toDate(
DateTimeFormat([date],'%Y') + "-" +
padleft(tostring(Ceil(ToNumber(DateTimeFormat(DateTimeAdd([date],-3,"month"),'%m'))/3)*3,0),2,"0") + "-01")
, "lastofmonth")

 

 

kelvin_law1
9 - Comet

Wrong post, sorry!!

AnilC
6 - Meteoroid

Hello Sir, Source that you referring is deleted, can you share the "tools created by James Dunkerley" please 

Labels