I have a date column with a DateTime data type, and I want to filter only one day of data, specifically from '2023-01-01 00:00:00' to '2023-01-01 23:59:59'. However, when using the following two formulas, they don't seem to be working for me:
Could someone please help me understand how to filter for data from a specific day using the filter tool?
Thank you!
Hi, @AKPWZ
1- If your [Date] type is datetime, then:
[Date] >= "2023-01-01 00:00:00" &&
[Date] <= "2023-01-01 23:59:59"
2- If not, you need trans the type to datetime by use formula first.
Hi @flying008 thank you for the response.
I tried it but still not working for me.
In Alteryx, you can filter data using the Filter tool and the DateTime functions. However, your current formulas have some issues.
Here's the correct approach:
Assuming you have a field named [date] with DateTime data type, you can use the following formula in the Filter tool:
DateTimeTrim([date], "day") = DateTimeFormat("2023-01-01", "yyyy-MM-dd")
This formula will trim the time component from the [date] field and compare it with the date '2023-01-01'. This way, it will filter for records that fall within that specific day.
Make sure to replace [date] with the actual field name in your dataset. Also, note that the DateTimeFormat function is used to convert the constant date '2023-01-01' into the same format as the [date] field.
Remember to configure the Filter tool to include records that match the condition.
Hi @AKPWZ
In order to help us help you, can you please provide some more details? Instead of just saying "It does not work for me", please provide some sample data and possibly some screen shots of the results after applying the techniques suggested by the other people on this post.
Thanks
Dan
