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

Minus month from the Month column

SH_94
11 - Bolide

Dear community,

 

I would like to ask how do we minus one month if we have the data below :

SH_94_0-1647744287432.png

 

I have attached in the excel file below for the reference as well.

 

Many thanks

 

3 REPLIES 3
gabrielvilella
14 - Magnetar

Hey @SH_94, you need to convert to a date then you can remove one month from it.

 

PadLeft(ToString(DateTimeMonth(DateTimeAdd(ToDate('2022-'+[Month]+'-01'),-1,'month'))),2,'0')

 

Qiu
21 - Polaris
21 - Polaris

@SH_94 
A different approach can be like this.

0320-SH_94.PNG

danilang
19 - Altair
19 - Altair

And for a 3rd different approach, try this

 

if month="01" then
	"12"
else
	padleft(tostring(tonumber([Month])-1),2,"0")
endif

 

 

Dan

Labels
Top Solution Authors