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 Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

MONTHSTART Failure in Server

knobsdog
8 - Asteroid

I have a workflow that's failing on Server b/c it uses the date function MONTHSTART.  Does anyone know of a way to use something similar that will run on Server?  Here's the function with generic field names if that helps.

 


IF DateTimeFormat(DateTimeToday(),"%d") > "15" and [scheduled_date]>= MONTHSTART (DateTimeToday()) and [scheduled_date]<=(DateTimeAdd(MONTHSTART(DateTimeToday()),+15,"days"))then "Keep"

 

elseif DateTimeFormat(DateTimeToday(),"%d") < "15" and [scheduled_date]>=

DateTimeFormat(DateTimeAdd(MONTHSTART(DateTimeAdd(MONTHSTART(DateTimeToday()),-1,"days")),+14,"days"),"%Y-%m-%d") and

[scheduled_date]<= DateTimeFormat( DateTimeAdd(MONTHSTART(DateTimeToday()),-1,"days"),"%Y-%m-%d") then "Keep"

 

else "Leave" endif

4 REPLIES 4
DataNath
17 - Castor

Hey @knobsdog, afaik MONTHSTART isn't a function in Alteryx and you'd want to use the DateTimeTrim() function instead, referencing the 'firstofmonth' date part. More on date functions here: https://help.alteryx.com/20221/designer/datetime-functions

 

DataNath_0-1659651622912.png

knobsdog
8 - Asteroid

So like this:    

 

IF DateTimeFormat(DateTimeToday(),"%d") > "15" and [scheduled_date]>= DateTimeTrim(DateTimeToday(),"%d") and [scheduled_date]<=(DateTimeAdd(DateTimeTrim(DateTimeToday(),"%d")),+15,"days"))then "Keep"

 

elseif DateTimeFormat(DateTimeToday(),"%d") < "15" and [scheduled_date]>=

DateTimeFormat(DateTimeAdd(DateTimeTrim(DateTimeToday(),"%d")(DateTimeAdd(DateTimeTrim(DateTimeToday(),"%d")),-1,"days")),+14,"days"),"%Y-%m-%d") and

[scheduled_date]<= DateTimeFormat( DateTimeAdd(DateTimeTrim(DateTimeToday(),"%d")),-1,"days"),"%Y-%m-%d") then "Keep"

 

else "Leave" endif

 

?

DataNath
17 - Castor

@knobsdog I’m not around my laptop to format your whole formula but one example of it would be DateTimeTrim(DateTimeToday(),"firstofmonth”)

 

From the documentation I linked above, here the dt (date) is DateTimeToday() and the f (date part) is ‘firstofmonth’.

 

So every instance you want to use month start (in this case first of month DateTimeTrim), you just need to wrap whatever date you’re referencing in the same way.

knobsdog
8 - Asteroid

I misunderstood.  I'll rework with that framework.  Thank you again.