Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Check out our powerful new search update! You can read more here. Please let us know if you have any feedback by creating a topic here.
SOLVED

calculate previous date

Highlighted
Meteoroid

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
Pulsar

Can you share a workflow and example data?

Highlighted
Alteryx 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
Meteoroid

nidah5_0-1581583898208.png

 

Highlighted
Meteoroid

yes, they all are in DATE format. 

Castor
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