Hi Community,
I would like to ask if anyone know how to fix the variable date format as shown below which need multiple formula to fix it.
Many thanks in advance on this.
Hi @SH_94
You can fix it by adding the new data format as part of else if block
IF !IsNull(DateTimeParse([Initial Date],"%d/%m/%y")) // Check whether it falls in the date format THEN DateTimeParse([Initial Date],"%d/%m/%y") // If yes then parse it with a new format ELSEIF !IsNull(DateTimeParse([Initial Date],"%d-%b-%y")) THEN DateTimeParse([Initial Date],"%d-%b-%y") ELSEIF !IsNull(DateTimeParse([Initial Date],"%Y-%m-%d")) THEN DateTimeParse([Initial Date],"%Y-%m-%d") ELSE Null() ENDIF // Returns null if its a new format
Hope this helps : )
This is a common date issue faced. What you can do is write a elseif block to parse each date format like below.
IF !IsNull(DateTimeParse([Initial Date],"%d/%m/%y")) // Check whether it falls in the date format THEN DateTimeParse([Initial Date],"%d/%m/%y") // If yes then parse it with a new format ELSEIF !IsNull(DateTimeParse([Initial Date],"%d-%b-%y")) THEN DateTimeParse([Initial Date],"%d-%b-%y") ELSE Null() ENDIF // Returns null if its a new format
Workflow :
In the similar way if there is more format. You need to write dateparse formats to parse them.
https://help.alteryx.com/current/designer/datetime-functions
Hope this helps 🙂
Sorry. I just rechecked the red highlighted row. Its a data inconsistency issue that needs to be fixed manually. Or use a if statement replace that date as a data fix.
Hi @atcodedog05 ,
Thanks a lot for the workflow provided.
I got the error as below as i think i forget to mention about the format date : 2021-02-23.
Do you know how can i fix this formula issue?