Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Filtering out the correct columns if conditions met

ashamluo
7 - Meteor

Hello I was wondering if anyone would know how to filter out the rows form a data set if conditions are met.

 

I have a dataset that gives me case statuses of different customers(ID), they may be open, reopen, resolved.

I want to know how much time it took a case from open/reopened to resolve. But i just want the most recent open/reopened and resolve cases.

 

So i did a group by ID, group by status, then taking the MAX. 

 

ORIGINAL DATASET

IDstatusTimestamp
AB-001open12/01/22 13:00:00
AB-001resolved12/02/22 11:00:00
AB-001reopened12/02/22 13:00:00
AB-001resolved12/02/22 18:00:00
AB-002open12/05/22 07:00:00
AB-002resolved12/06/22 13:00:00
AB-003open12/06/22 14:35:00
AB-003resolved12/06/22 07:49:00
AB-003reopened12/07/22 07:00:02
AB-003resolved12/12/22 10:00:00
AB-004reopened12/05/22 11:52:43
AB-004resolved12/06/22 13:02:59

 

Then after taking the MAX the data set would look like this which would filter out the other resolve cases leaving only the most recent resolved cases.

IDstatusTimestamp
AB-001open12/01/22 13:00:00
AB-001reopened12/02/22 13:00:00
AB-001resolved12/02/22 18:00:00
AB-002open12/05/22 07:00:00
AB-002resolved12/06/22 13:00:00
AB-003open12/06/22 14:35:00
AB-003reopened12/07/22 07:00:02
AB-003resolved12/12/22 10:00:00
AB-004reopened12/05/22 11:52:43
AB-004resolved12/06/22 13:02:59

 

After this I am not sure how to proceed. I want to take the date difference of the most recent open/resolved or reopened/resolved per ID.

But there are many cases and I am not sure how to do it.

 

1. If open and reopened are both present then I am taking reopened.

2. If open is present and reopened is missing then I am taking open.

3. If reopened is present and open is missing then I am taking open. (weird cases)

 

This is my end goal.

IDStatusTimestamp
AB-001reopened12/02/22 13:00:00
AB-001resolved12/02/22 18:00:00
AB-002open12/05/22 07:00:00
AB-002resolved12/06/22 13:00:00
AB-003reopened12/07/22 07:00:02
AB-003resolved12/12/22 10:00:00
AB-004reopened12/05/22 11:52:43
AB-004resolved12/06/22 13:02:59

 

Thank you in advance!

6 REPLIES 6
Matthew
11 - Bolide

this might do the trick

 

filter the resolved timestamp out, summarise the max timestamp by ID for both the "true" and "false" outputs from the filter, then join them back together.. from there you can calculate the difference between the two timestamps

 

Matthew_0-1654785148409.png

 

 

 

IraWatt
17 - Castor
17 - Castor

Hey @ashamluo,

I think you want to cross tab your data to apply these conditions. I had a try but I'm not sure I follow your logic:

IraWatt_0-1654783985288.png

The formula has your ruleset to take the value you want but it does not seem to match your desired output

binuacs
21 - Polaris

@ashamluo one way of dong this with the sample tool

 

binuacs_1-1654808815020.png

 

 

ddiesel
13 - Pulsar
13 - Pulsar

Hi @ashamluo!

 

Will you let us know if any of these solutions worked for you?

 

Thanks,
Deb

ashamluo
7 - Meteor

Thank you for all the solutions!  I am sorry, previously I lost my internet while accepting the solution.

IraWatt
17 - Castor
17 - Castor

No worries @ashamluo ! Glad you got it sorted 😄

Labels
Top Solution Authors