Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

a calculation that gives me last month date with the maximum number of days on that month?

silvanaweinaug
6 - Meteoroid

 

How can I create a calculation that gives me last month's date with the maximum number of days that month?

silvanaweinaug_0-1579282594373.png

 

For example, if I run it today (or any day this month), it should give me 12/31/2019 (as a date format), because last month maximum day was 31 ( see image below)

silvanaweinaug_1-1579282594376.png

But if I would have run it any day last month, it should give 11/30/2019 (as a date format), because previous last month maximum day was 30 ( see image below)

silvanaweinaug_2-1579282594381.png

Thank you,

 

2 REPLIES 2
KP_DML
8 - Asteroid

Hello,

You can get there with a combination of date functions:

 

ToDate(DateTimeTrim(DateTimeAdd(DateTimeNow(),-1,"month"),"lastofmonth") )

silvanaweinaug
6 - Meteoroid

thank you

Labels
Top Solution Authors