Alteryx Designer Discussions

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

calculate previous date

nidah5
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

5 REPLIES 5
DavidP
16 - Nebula
16 - Nebula

Can you share a workflow and example data?

Jonathan-Sherman
15 - Aurora
15 - Aurora

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

nidah5
8 - Asteroid

nidah5_0-1581583898208.png

 

nidah5
8 - Asteroid

yes, they all are in DATE format. 

danilang
18 - Pollux
18 - Pollux

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