Alteryx Designer Desktop Discussions

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

Sequence of activities

svergtanya
7 - Meteor

Hi,

I would like to check that sequence of activities per every unique ID is correct or not. It should be based on the timestamp.

Out of all activities (can be repetitive), I need to check that the main 7 have happened and the order of them was correct.

Example below:

 

ID TimestampActivityCorrect
1232020-10-01 01:01:13ACYes
1232020-10-01 01:01:14ACYes
1232020-10-01 01:01:15DCYes
1232020-10-01 01:01:17ACNo
2132020-10-01 02:01:13ACYes
2132020-10-01 03:01:13DCYes
2132020-10-01 04:01:13GSNo
5 REPLIES 5
Kenda
16 - Nebula
16 - Nebula

Hi @svergtanya 

 

I have just a few clarifying questions to make sure I answer what you're looking for

    1. Is the Correct field the one you are trying to automatically generate here?

    2. Can you explain why records 4 and 7 are No?

svergtanya
7 - Meteor

Hi @Kenda 

 

1) Yes, I would like to generate the field "Correct"

2) I have a process, where are rules, which activities should be followed by which. For example, 'AC should be followed by DC and don't be repeated later after next activity.

If to look at them aggregated, so input can look like this 'AC, AC, DC, GC, FC, HF, TS, OP, DC, AC, ML'

and pattern should be 'AC, DC, FC, OP, TS, ML'

So, then if to color input, green - correct and red - wrong.

'AC, AC, DC, GC, FC, HF, TS, OP, DC, AC, ML'

 

Kenda
16 - Nebula
16 - Nebula

Hello @svergtanya 

 

I'm still not sure I have the entire picture, but I will attempt to provide you with something.

 

First try sorting your data by ID then timestamp, both ascending. Then use a Multi-Row formula tool to create a new string field with the values for rows that don't exist set to the closes valid row, grouping by ID, and with this expression:

iif([Row-1:Activity]="AC", 
	iif([Activity]in("AC", "DC", "FC", "OP", "TS", "ML"), 
		"Yes", "No"),
iif([Row-1:Activity]="DC", 
	iif([Activity]in("DC", "FC", "OP", "TS", "ML"), 
		"Yes", "No"),
null()))
	

 

This should be the basic logic that you can build from. Basically it is saying if the previous row was AC, then if this row's activity is listed in row 2 above, then say Yes. If the previous row was AC but this row is not in that list, say No. Then you just filter through all possible combinations of values for the previous row and allowed values for the current row.

 

Hope this helps!

 

Kenda_0-1605035732571.png

 

PhilipMannering
16 - Nebula
16 - Nebula

Hi @svergtanya 

 

Maybe you can adapt something from this,

PhilipMannering_0-1605036182618.png

 

svergtanya
7 - Meteor

@Kenda thank you for the recommendation. I'm trying to run your expression with iif, but somehow it always gives  'NULL'. 

Labels