Alteryx Designer Desktop Discussions

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

Date Time Month Calculation

ZoeM
Asteroid

Hello!

I have a data set where I would like to have a new field which changes based on the status of another field.

Ideally, I have a product and when the product is completed, a  completion date is provided e.g. 6/23/2022. I want a field that tells me whether the completion date falls within the current month i.e. all products that complete in June will say Yes and all others will say No. And when we move to July, same thing all over again. June products move to No and July completed products will be Yes. 

 

I know there is a Date time Month but I do not know how to construct this.  And I hope I have provided enough detail to summarize the outcome desired. 

 

Thanks!

4 ANTWORTEN 4
DataNath
Castor

Hey @ZoeM, will your dates always be in that format i.e. mm/dd/yyyy? If so, you can use this:

 

 

IF DateTimeTrim(DateTimeParse([Date],'%m/%d/%Y'), 'month')
= DateTimeTrim(DateTimeToday(),'month') THEN 'YES' ELSE 'NO' ENDIF

 

Or:

 

IF DateTimeMonth(DateTimeParse([Date],'%m/%d/%Y'))
= DateTimeMonth(DateTimeToday()) THEN 'YES' ELSE 'NO' ENDIF

 

 

DataNath_0-1655987803112.png

 

It'll always be dynamic due to the DateTimeToday() function. Workbook attached!

Use  a formula like this.

if datetimemonth([DateTime_Out]) = DateTimeMonth(DateTimeToday())
then "YES"
else "NO"
endif

 

Robin_McIntosh_0-1655987850324.png

If you are looking for both current month and year then this formula:

 

if (datetimemonth([DateTime_Out]) = DateTimeMonth(DateTimeToday())
&& DateTimeYear([DateTime_Out]) = DateTimeYear(DateTimeToday()))
then "YES"
else "NO"
endif

 

Robin_McIntosh_0-1655989505667.png

 

Jay-RDC
Asteroid

Hello, You can use a summary tool to set the max and min date for the current month (make sure to create a formula tool to set the calculation). The summary tool will create max date and min date within the month so you can set a logic that if it falls within min and max month it's "yes" else "no".

Jay-RDC
Asteroid

jayrdelacruz18_0-1655988409930.png

jayrdelacruz18_1-1655988423299.pngjayrdelacruz18_2-1655988429991.png

 

 

Beschriftungen