Community Halloween is live until October 31st! Complete any 2 quick activities to earn the 2025 Community Halloween badge. Feeling brave? Check out the activities here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Find previous month using YYYY-MM string

nsarayar
7 - Meteor

Hi

 

I have a date in the format  YYYY-MM which is formatted as a string. I want to find the previous month, How would i do this?

 

So 2021-06 > 2021-05, 2022-01  > 2021-12

 

Thanks!

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @nsarayar

 

You can use formula like below. Covert it to date, minus 1 month and convert it back to fromat

 

DateTimeFormat(
DateTimeAdd(DateTimeParse([Month],"%Y-%m"),-1,"month")
, "%Y-%m")

 

 

Workflow:

atcodedog05_0-1625673320262.png

 

Hope this helps 🙂

Vaithi
7 - Meteor

Hi nsarayar,

 

Here is the workflow. Hope this helps 🙂

nsarayar
7 - Meteor

@atcodedog05 perfect thanks!

nsarayar
7 - Meteor

@Vaithi - great thank you so much!!

Labels
Top Solution Authors