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

Create a month field

paulb1
8 - Asteroid

Hi All,

 

I'm rather new to Alteryx, and I've been addicted to training videos to the point things are starting to get blurry.  :)

 

I've done a count distinct on a field and I want to be able to group those counts by month.  My date field is in this format  2017-02-15  (YYYY-MM-DD).  I'd love to be able to create a new field called Month, and parse the month from my dates into that field (in this style, Jan, Feb, Mar, etc.).   I've tried a couple of things but no success.    Using v11.  Using the date function DateTimeMonth([svcDate]) , I keep getting the error: Formula (8): The field "" is not contained in the record. (Expression #1).  Argh!

 

Please and thank you,

 

Paul

3 REPLIES 3
jdunkerley79
ACE Emeritus
ACE Emeritus

The expression you have will get the month number (1-12). The error is saying you haven't specified an output column name in the formula tool:

2017-11-25_07-37-21.jpg

 

 If you want Jan-Dec rather than 1-12 use the expression:

DateTimeFormat([svcDate],"%b")

Alternatively you can use a DateTime tool to take a date to a string with a custom format of 'Mon'

paulb1
8 - Asteroid

Thanks JD,

 

How do I specify a valid output column?  I'm referencing the original date field in both the output column and my expression.  This renders my Service Date field null.  If I use a 'new' column name in my expression, I get the same error as before.  Thanks for helping!!

 

dateformat.JPG

paulb1
8 - Asteroid

Nevermind.  I found the Add Column option.  Thank you for the solution.

Labels