Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Date Format and Selection

SH_94
11 - Bolide

Hi Community,

 

I face obstacle in the date formatting and selection which i would like to seek for the help.

 

Date Formatting

1. I not sure how to build the workflow to change the date to become the format : YYYY- MM-DD.

 

Jacob_94_0-1616053916506.png

 

2. Date Selection

For the date below, if the due date was before 2020-12-31, we will choose the due date as final date. However, if the due date was after 2020-12-31, we will choose the 2020-12-31 as final date.

 

Jacob_94_1-1616054042172.png

 

 

4 REPLIES 4
Qiu
21 - Polaris
21 - Polaris

@SH_94 

First question

Capture7-1.PNG

messi007
15 - Aurora
15 - Aurora

@SH_94 ,

 

Please see below :

 

messi007_0-1616055246691.png

 

If this solve the need please mark it solved it will help others,

 

Attached the workflow,

 

Regards,

Qiu
21 - Polaris
21 - Polaris

@SH_94 

The second one.

but the second row seems the wanted result is not correct.

Capture7-2.PNG

AngelosPachis
16 - Nebula

Hi @SH_94 ,

 

For question no.1, one way to do it is with an if statement. You will check if a string contains a "/", and if it does then that means that it's in the format of day/month/year. You can use an embedded function called datetimeparse to convert that string into a date field (More on Date Functions in Alteryx here).

 

Else your date will be in the year-month-date format that Alteryx is happy with, so you should leave it as is.

 

AngelosPachis_0-1616055323207.png

 

Then for question no.2, you adopt a similar logic to convert the dates, but you use an extra if statement to assign the correct Final Date

 

AngelosPachis_1-1616055439633.png

 

There are alternatives of course to using the contains function which is more generic (that alternative is called regex) but lets keep it simple for now.

 

Hope that helps,

 

Angelos

 

Labels