Alteryx Designer

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

Looking for Formula that looks for the first date in the previous month

Highlighted
5 - Atom

Hi guys,

 

I don't have a workflow to share but I think this should be an easy answer for someone besides me I have tried searching through past questions, training materials for a couple hours already.

When using the Formula tool I've figured out how to create a formula that looks for the last day in the previously month

 

Example that works: 

= DateTimeAdd(
DateTimeTrim(DateTimeToday(),'FirstOfMonth'),-1,'day')"

 

 But I'm having trouble making a formula that looks for the first day of the previous month? I'd prefer to find a solution that doesn't rely on a date if possible.

 

Example that I need help with as it doesn't work for me:

 

= DateTimeAdd(
DateTimeTrim(DateTimeToday(),'FirstOfMonth'),-1,'month')

 

Thanks in advance!

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

@Data_Driven ,

 

DateTimeFormat(DateTimeAdd([Any Date],-1,"month"),"%Y-%m-01")

 

or ....

 

DateTimeFormat(DateTimeAdd(DateTimeStart(),-1,"month"),"%Y-%m-01")

 

cheers,

 

mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Highlighted
5 - Atom

@

 

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Lots of ways to solve and I'm thankful that you liked mine. 

cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Labels