We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun 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
12 - Quasar

@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
12 - Quasar

@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
12 - Quasar

@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