Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Extracting Last 24 Hours Data

MD2050
8 - Asteroid

Hello Everyone-

I have a data which has date and time scans when a sales-order is scanned complete (please find in attached the sample data). what i am trying to achieve here is pull those sales-order which were scanned in last 24 hours form the time when the report is executed. Meaning if the report is scheduled to come out at 8am on 8/16/18 then is should have all the scanned Sales-order from 8am 8/15/18 through 7:59 am 5/16/18. 

I tried [Scan_DteTime]=DateTimeAdd([Timenow],-24,'hours') and it didn't worked . 

Will really appreciate any guidance. 

 

Thank you .

4 REPLIES 4
patrick_digan
17 - Castor
17 - Castor

@MD2050 try switching your equal sign to a >= sign, like:

[Scan_DteTime]>=DateTimeAdd([Timenow],-24,'hours') 
MD2050
8 - Asteroid

Hello @patrick_digan

The step worked !! Thank you for quick reply. 

I would like to ask another question out of curiosity  : what else if i have to pull data from a specific period ? meaning 8 am onwards from 8/15 through 7:59 am 8/16.

In the above example we use the time stamp to go back 24 hours. Just curious to see how the approach will differ in case we need to hard coding the time frame.

Thank you again for your help.  

patrick_digan
17 - Castor
17 - Castor

@MD2050 I've attached an example. You'll just want to save it to the same directory as that sample excel file you posted. The left side uses DateTimeNow(), The middle uses the timestamp from the excel file, and the right side is if you wanted to hardcode it. Then I just compare the time to the start and end time variables that we've created.

MD2050
8 - Asteroid

Hello @patrick_digan

Your solution worked perfectly. Thank you very much for your help.

MD 

Labels