Multiple IF condition for Date and time
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello,
I have a per second data for each day and I would like to define a condition where any row which falls on a "Friday 12 am to 3pm" should be removed.
Can you please tell how can I achieve this in alteryx?
I have tried a lot of datetime functions and nothing seems to be working.
Thank you
Regards,
Pankhudri
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello @atcodedog05 ,
Thank you for your quick response.
I have attached the sample dates in an excel file.
So I have to check for every datetime if its a Friday AND falls between 12 am and 3 pm.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Is your data already in standard date time format?...
If so you can test for this with a filter and
datetimeformat([datetimefield],"%A")!="Friday" or tonumber(datetimeformat([datetimefield],"%H"))>=15
this isn't testable with the data you uploaded though because there are no Fridays...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello @apathetichell ,
Thank you for your response.
I want both conditions to be true Friday and between 12am to 3pm.
I have converted the field into datetime format with "DatetimeParse([LogDate],'%m/%d/%Y %I:%M:%S %p')".
Also, should I use a multi row formula here?
Regards,
Pankhudri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Pankhudri20
Here is how you can do it. Filerting out Friday and between 12am to 3pm.
Workflow:
Hope this helps : )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Pankhudri20 ,
You can remove wanted rows using Filter tool. i used formula tool and created new fields to show you functions to use !
Find attached workflow !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Pankhudri20
@Pankhudri20 wrote:
Hello @apathetichell ,
I have converted the field into datetime format with "DatetimeParse([LogDate],'%m/%d/%Y %I:%M:%S %p')".
Seems like your date column is already in date type in excel. Directly load your data into Alteryx from excel it will get treated as date.
Hope this helps : )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Pankhudri20 fyi - my formula - uses !="friday" so therefore any record with a time after 3 pm. or not a Friday will be "TRUE" and the removed records (Friday 0-15) will be "False"... It usually helps to keep the removed records in the false side of the anchor... If you wanted it to the other side you can use ="Friday" and replace "Or" with "And"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
My approach below and workflow attached.
I've added the following to your sample data and worked great to remove the first 3.
7/23/2021 12:00:01 AM
7/23/2021 2:59:59 PM
7/23/2021 3:00:00 PM
7/23/2021 3:00:01 PM