Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
GELÖST

Monthrange in Alteryx

terrellchong
Asteroid

so in python there is this thing called monthrange, which finds the date of the month for you

 

so let say I have

Month : 8
Year : 2020

when i write 

 

calendar.monthrange(Year_S, Month_S)[1]

 

in python, it recognizes it and gave me 31

 

I have a set of inputs, where i'll attach, is full of years and months of the following code

 

i wish to create a set of column like my output, so that I can find the days in the month and then find out the remaining days that i have for my datasets.

 

How should i write my code in formula tool?

3 ANTWORTEN 3
atcodedog05
22 - Nova
22 - Nova

Hi @terrellchong 

 

There is no single formula like python. But you can use formula like below to get the dates.

 

Workflow:

atcodedog05_0-1641288542654.png

Hope this helps : )

 

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @terrellchong 

Cheers and have a nice day!

RolandSchubert
16 - Nebula
16 - Nebula

Hi @terrellchong ,

 

there is not function to return the last day in a month, but it is quite easy to find:

 

First step is to create a date data type for the first of month (IsNull is needed because of partially empty rows)

 

2022-01-04_10-37-46.jpg 

You go to the first of the next month, one day back and have the day you ned as a date. DateTimeFormat returns the day.

 

Let me know if it works for you.

 

Best,

 

Roland

 

Beschriftungen