In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Simple calculation

Kallis
8 - Asteroid

Hi Friends

 

I need a simple calculation. The idea is to go to the previous month. CurrMonth returns 8 (August) I want PrevMonth to be 7 (July)

Direct minus is not working. Any suggestion?

 

Kallis_0-1755181187155.png

 

6 REPLIES 6
abacon
13 - Pulsar

@Kallis Alteryx has a DateTimeAdd function that you can use to add/subtract from any part of the date depending on how you format it.

 

Bacon

 

image.png

Kallis
8 - Asteroid

Hi @abacon 

Thanks but this is not what I am expecting.

I need to get 7 (July)

abacon
13 - Pulsar

@Kallis Update the formula to the below formula.

 

What I did was pull the month value from the newly created July date.

 

Bacon

DateTimeMonth(DateTimeAdd([date],-1,'month'))

 

Kallis
8 - Asteroid

Hi @abacon 

 

DateTimeAdd is not recognised

 

Kallis_0-1755182784491.png

 

abacon
13 - Pulsar

@Kallis You are doing it on the wrong field, because CurrMonth is an Integer, not a date, it's not working. Do you PrevMonth calc using a date field, in this case the DateTimeNow() field.

 

Bacon

 

DateTimeMonth(DateTimeAdd(DateTimeNow(),-1,'month'))
Kallis
8 - Asteroid

Thanks @abacon 

It works now.

Labels
Top Solution Authors