ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
解決済み

Get Previous Month first day at any given date

msedrech0114
メテオール

Can anyone help I want to add a formula expression that would get the first day and last day of previous month of a given date field.

 

e.g

Field_1: 2018-05-05

Output_1: 2018-04-01

Output_2: 2018-04-30

 

In sql, there's an expression to handle this case but can't find a solution yet in Alteryx.

 

 

Appreciate any help in advance. 

 

 

Mark

3件の返信3
AdamR_AYX
Alteryx Alumni (Retired)

I think these formulas do what you want:

 

Previous Month = DateTimeAdd([OriginalDate],-1,"month")

FirstOfPreviousMonth = DateTimeAdd([Previous Month], 1-DateTimeDay([Previous Month]), "days")

LastOfPreviousMonth = DateTimeAdd([OriginalDate], 0-DateTimeDay([OriginalDate]), "days")

 

 

Adam Riley
https://www.linkedin.com/in/adriley/
msedrech0114
メテオール

Thank you AdamR! your formulars work!

sushobhan
アトム

Try this

DateTimeAdd(DateTimeLastOfMonth(),-2,"months")

ラベル
トップのソリューション投稿者