We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Year of previous month

MRPP
6 - Meteoroid

Hi Community !

 

Need your help to figure out how to calculate 'Year of previous month'. I work on a report which is a 'snapshot' of previous month. While there's no issue with year (whether current month or previous) during Jan, I would be working on Dec data of 'last' year, so my formula needs to point to 2022 when I would be reporting on Jan'23 month.

 

something that must look like this: [Ddate Year] = ToNumber(DateTimeFormat(DateTimeToday()-30,"%Y"))

 

Thanks in advance !

3 REPLIES 3
ChrisTX
16 - Nebula
16 - Nebula

Try this formula:   DateTimeYear(DateTimeAdd([MyDate],-1,"months"))

 

ChrisTX_0-1660314260531.png

 

 

Chris

PhilipMannering
16 - Nebula
16 - Nebula

Hey @MRPP You want something like,

datetimeyear(datetimeadd(DateTimeToday(), -1, 'month'))
MRPP
6 - Meteoroid

This works !

Labels
Top Solution Authors