Hi,
I have a very simple question!
How to I filter all the Date values from a column with Sting values included. My Date format is yyyy-mm-dd.
Thanks
Solved! Go to Solution.
Hi @rajputakansha ,
I have created 2 examples in how to filter dates. One way is by simply changing the data type, the other is by using a datetimediff function.
If this solves your issue please mark the answer as correct, if not let me know!
Hope this helps.
Best,
Fernando V.
Hi @rajputakansha,
Is this what you're trying to achieve?
Input:
Output:
If so i would use a Regex_Match function inside a filter tool REGEX_Match([Column], '\d{4}-\d{1,2}-\d{1,2}')
If this solves your issue please mark the answer as correct, if not let me know! I've attached my workbook for you to download if needed.
Regards,
Jonathan
Hi @fmvizcaino ,
Thanks for your response.
Can you please explain how changing the data type can filter the values.
Example;
COLUMN
abc
2019-12-12
bcd
2019-02-12
rfg
2018-01-10
This is my column from which I want to filer out the dates.
Thank you!
Sure @rajputakansha, it's looking for cells that contain 4 digits followed by a hyphen, followed by between 1 and 2 digits, followed by a hyphen, followed by between 1 and 2 digits. The rows that match this are then coming out of the true anchor of the filter tool, and those that do not fulfill that condition are coming out of the false anchor.
If it's still unclear just let me know!
I haven't changed the data type at all, it may be worthwhile doing it after the filter tool however. The filter tool is simply checking whether each row fits the condition i mentioned previously, 4 digits, hyphen, 1 or 2 digits, hyphen, 1 or two digits.
Hi @rajputakansha ,
By changing the data type, since Alteryx only consider as date strings with year-month-day format, it does the job automatically when using the filter tool as the 1st example.
Hope this helps.
Thanks,
Fernando Vizcaino
@rajputakansha the reason I did not go down the same route as @fmvizcaino is because changing the data type would remove the (non date) rows from the data stream. Using a filter against a regex_match would still keep these "non date" rows available to be used later in the workflow if so desired.