Alteryx Designer Desktop Discussions

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

Conditional While Statement Based on Total No of Fields

reddyd3
5 - Atom

Hi, 

I've a dataset with three fields  ID, Team , Order Number.

Now I am trying to build a 'case flow' based on how the 'Team' changes for each ID.

Below is the sample data 

IDTeamOrder Number
5005b00001ISpPKAA1 1
5005b00001ISpPKAA1Network2
5005b00001ISpPKAA1PDS3
5005b00001ISpPKAA1PDS4
5005b00001ISpPKAA1PDIU5
5005b00001ISpPKAA1PDIU6
5005b00001ISpPKAA1PDS7
5005b00001ISpPKAA1Network8
5005b00001ISpPKAA1PDS9
5005b00001ISpPKAA1PDIU10
5005b00001ISpPKAA1PDIU11
5005b00001ISpPKAA1PDS12
5005b00001ISpPKAA1Network13
5005b00001ISpPKAA1PDS14
5005b00001ItbDKAAZ 1
5005b00001ItbDKAAZNetwork2
5005b00001ItbDKAAZPDS3
5005b00001ItbDKAAZPDS4
5005b00001ItbDKAAZPDS5
5005b00001ItbDKAAZPDS6
5005b00001ItbDKAAZNetwork7
5005b00001ItbDKAAZPDS8
5005b00001ItbDKAAZNetwork9
5005b00001ItbDKAAZPDS10

By using a cross tab  I was able to transform data as below.

 

IDMax_Order Number1234567891011121314
5005b00001ISpPKAA114 NetworkPDSPDSPDIUPDIUPDSNetworkPDSPDIUPDIUPDSNetworkPDS
5005b00001ItbDKAAZ10 NetworkPDSPDSPDSPDSNetworkPDSNetworkPDS    
5005b00001JxBz9AAF8 NetworkPDSPDSNetworkPDSNetworkPDS      

 

My question is I need write a condition to show the flow for each ID only when the team in the subsequent field changes. 

The number of fields for Each Id is shown by Max Order Number.

 

Below is the expected Outcome

 

IDMax_Order NumberCase Flow
5005b00001ISpPKAA114Network-PDS-PDIU-PDS-Network-PDS-PDIU-PDS-Network
5005b00001ItbDKAAZ10Network-PDS-Network-PDS-Network-PDS
5005b00001JxBz9AAF8Network-PDS-Network-PDS-Network-PDS

 

I have uploaded the data in the file. Any help is much appreciated .

Thank you,

Digvijay

6 REPLIES 6
binuacs
20 - Arcturus

@reddyd3 

binuacs_0-1643839659824.png

 

reddyd3
5 - Atom

Hi Binuacs, 

 

Thank you very much for sharing the solution.

You see the condition is that if the same team appear in subsequent rows that value should be skipped until the team changes, so when you see PDS and PDS appearing in the two consequent rows it should not repeat the team value. 

 

So even though we have 10 rows for the second ID,

IDMax_Order Number1234567891011121314
5005b00001ItbDKAAZ10 NetworkPDSPDSPDSPDSNetworkPDSNetworkPDS    

 

we should have below outcome:

IDMax_Order NumberCase Flow
5005b00001ItbDKAAZ10Network-PDS-Network-PDS-Network-PDS

 

Is there anyway we can do that.

 

thank you,

DJ

 

 

Sebastiaandb
12 - Quasar

Hi @reddyd3 ,

 

I took @binuacs workflow and altered it (so credits for him, thanks!)

Sebastiaandb_0-1643898952073.png

 

Greetings,

 

Seb

 

 

reddyd3
5 - Atom

Hi Sebastiandb,

 

Can you please attach the alteryx workbook. 

 

Thank you so much for the solution.  This helps a lot for my analysis. :-)

 

Digvijay

binuacs
20 - Arcturus

@reddyd3 

binuacs_0-1643924371665.png

 

reddyd3
5 - Atom

Thank you!! 

Labels