In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!
Free Trial

General Discussions

Discuss any topics that are not product-specific here.
SOLVED

Set Month based of number of the days of the month

marc_allen
5 - Atom

Any idea how I could return the month using the below conditions

 

Output Column: NEW DATE

If [MYDATE] = Monday AND [Day of Month = 1, 2 or 3) 

or [MYDATE] = [Day of Month] = 1

Then Month = Previous month

Else Month = Current month

 

Thanks for your help!

2 REPLIES 2
DataNath
17 - Castor
17 - Castor

Hi @marc_allen, from your logic I think I've created what you're after - does this look like what you had in mind? The main expression is the third one, kept the others in to show the logic throughout.

 

Create NEW DATE field.png

 

IF (DateTimeFormat([MYDATE],'%A') = 'Monday' AND DateTimeDay([MYDATE]) IN (1,2,3)) OR DateTimeDay([MYDATE]) = 1
THEN DateTimeFormat(DateTimeAdd([MYDATE], -1, 'month'),'%B')
ELSE DateTimeFormat([MYDATE], '%B')
ENDIF
marc_allen
5 - Atom

Amazing! Perfect first time - thanks so much! :-)

Labels
Top Solution Authors