Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
ALTER.NEXT:

Join us on Dec 2 for a half-day virtual analytics + data science event!
US & CA customers only

SAVE YOUR SPOT
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!
SOLVED

calculate previous date

Highlighted
8 - Asteroid

hi,

i have DATE field MONTH_YEAR WITH THE FORMAT '2018-07-01'- YYYY-MM-DD, which is CURRENT MONTH of each Customer

I have calculated PREVIOUS MONTH for each customer, so i have to put the condition FILTER where 

MONTH _YEAR = PREVIOUS+1

OR

PREVIOUS_MONTH = MONTH_YEAR + 1 

 

I have used this filter but its not working

[MONTH_YEAR]=DateTimeAdd([Previous_Month],1,"months")

 

can i get some help?

 

 

thanks

Highlighted
16 - Nebula
16 - Nebula

Can you share a workflow and example data?

Alteryx Certified Partner
Alteryx Certified Partner

Hi @nidah5,

 

Your formula [MONTH_YEAR]=DateTimeAdd([Previous_Month],1,"months") looks like it should work fine, however it may be worth checking data types. Are both [MONTH_YEAR] and [Previous_Month] fields stored as date data types? Otherwise a screenshot of the error would make it a lot easier to diagnose.

 

If this solves your issue pleas mark the answer as correct, if not let me know!

 

Regards,

Jonathan

Highlighted
8 - Asteroid

nidah5_0-1581583898208.png

 

Highlighted
8 - Asteroid

yes, they all are in DATE format. 

Highlighted
17 - Castor
17 - Castor

Hi @nidah5 

 

DateTimeAdd() returns a DateTime data type, i.e. 2018-09-01 00:00:00.  Even though this represents the same period as 2018-09-01, Alteryx sees them as different.  Use this formula in your Filter

 

[MONTH_YEAR]=ToDate(DateTimeAdd([PREVIOUS_MONTH],1,"months"))

 

Dan

Labels