Alteryx Designer Desktop Discussions

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

Multiple IF condition for Date and time

Pankhudri20
8 - Asteroid

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 

38 REPLIES 38
atcodedog05
22 - Nova
22 - Nova

Hi @Pankhudri20 

 

Can you please provide sample data so that we can help you better 🙂

Pankhudri20
8 - Asteroid

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.

 

 

apathetichell
18 - Pollux

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...

Pankhudri20
8 - Asteroid

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

atcodedog05
22 - Nova
22 - Nova

Hi @Pankhudri20 

 

Here is how you can do it. Filerting out Friday and between 12am to 3pm.

 

Workflow:

atcodedog05_0-1627305835982.png

 

Hope this helps : )

 

Jean-Balteryx
16 - Nebula
16 - Nebula

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 !

atcodedog05
22 - Nova
22 - Nova

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 : )

apathetichell
18 - Pollux

@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"

HomesickSurfer
12 - Quasar

@Pankhudri20 

 

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

 

Capture.PNG

Labels