Alteryx Designer Desktop Discussions

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

finding the quarter across years

praneshsapmm
8 - Asteroid

Hello ,

 

I have this requirement . 

 

Iam trying to find the 'closing month' with this formula : 

 

DateTimeFormat(DateTimeToday(),"%m") -1 

 

and attach to the year to generate output : closing month + year . 

 

for example : 092020 .

 

Untill now it is working , but when i run this solution in January 2021 for the closing month on December 2020 how does this work . 

 

Any help .

 

4 REPLIES 4
echuong1
Alteryx Alumni (Retired)

You can use the datetimeadd() function to find the previous month. From there, you can use the datetimeformat() to put it into MMYYYY.

 

echuong1_0-1603206452623.png

 

atcodedog05
22 - Nova
22 - Nova

Hi @praneshsapmm 

 

Here is a formula using DateTime functions. Considers previous month then formats

 

DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,"month"),"%m%Y")

Output:

atcodedog05_0-1603206611676.png

Workflow:

atcodedog05_1-1603206654218.png

Hope this helps 🙂


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

 

 

praneshsapmm
8 - Asteroid

Hi ,

 

Thanks for the response . 

 

Just wondering will this give the result across two different years . 

 

For example : If iam running in Januaary 2021 , then will it show previous month as 122020. 

 

Thanks

estherb47
15 - Aurora
15 - Aurora

Hi @praneshsapmm 

 

The DateTimeAdd function will work from year to year. I've marked the first solution so that others who have the same question can find an answer.

 

Cheers!

Esther

Labels