Free Trial

Alteryx Designer Desktop Discussions

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

Calculating Task Time

palberty
5 - Atom

I am very new to Alteryx and need to calculate time spent on each transaction.  I have my data sorted by UserID and then by Time descending.  I want to subtract the transaction time of the current task from the time of the previous task to get the task time as long as the UserID is the same.  This would go into a new column titled "Task Time."  Thank you for the help.

 

 

8 REPLIES 8
ShankerV
17 - Castor

Hi @palberty 

 

One way of doing this.

 

ShankerV_0-1676657719678.png

 

Many thanks

Shanker V

BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@palberty the tool you're after is called the Multi-Row formula. It lets you calculate values based on previous/future rows.

BS_THE_ANALYST_2-1676657827878.png

 

 

Here's a link to a lesson about the multi-row: https://community.alteryx.com/t5/Learning-Paths/Advanced-Certification-Learning-Path/ta-p/660137#don... 

 

see picture below on where to click to get through to the lesson:

BS_THE_ANALYST_1-1676657731133.png

 

 

 

All the best,
BS

LinkedIN

Bulien
ShankerV
17 - Castor

Hi @palberty 

 

If needed in minutes, just added a formula tool. 

Or we can also replace with the formula 

 

IF [UserID]=[Row+1:UserID]
THEN datetimediff([DateTime_Out],[Row+1:DateTime_Out],"minutes")
ELSE null()
ENDIF

 

ShankerV_0-1676657960568.png

 

Many thanks

Shanker V

BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@ShankerV don't let the excel preview trick you. There are actually seconds in the underlying data:

BS_THE_ANALYST_1-1676658236966.png

 

 

All the best,
BS

LinkedIN

Bulien
ShankerV
17 - Castor

Hi @BS_THE_ANALYST 

 

Oh, I missed it as I copied the data and pasted as a text input as the workflow will not be dependent on input file.

 

ShankerV_0-1676658502692.png

 

Thanks for highlighting...

 

Many thanks

Shanker V

BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@ShankerV I didn't know the copy and paste wouldn't pick it up!? Glad you let me know. Thanks!

 

All the best,
BS

LinkedIN

Bulien
ShankerV
17 - Castor

Hi @BS_THE_ANALYST 

 

Also I have a contradiction, where I am using Alteryx advanced version.

When i imported the data from excel, it auto corrects to the ISO date.

 

Then I will not use the Datetime tool, and when it is used in other older versions my workflow will provide and incorrect result/error.

 

That's why I copy and paste the data in text input tool to make sure it work in all versions.

 

ShankerV_0-1676659562779.png

 

Many thanks

Shanker V

palberty
5 - Atom

 Thank you very much for the help.

Labels
Top Solution Authors