Alteryx Designer Desktop Discussions

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

Cleaning a column in alteryx

NadaH
6 - Meteoroid

Hello everyone,

I have an issue trying to clean the a column on my workflow.

 

I got this table and would like to clean column A by removing the occurrences

ABC
hi,hi,hi,hi,hello145
ab,ab,an,an254
de,bon,bon332

 

I should have this result:

 

ABC
hi,hello145
ab,an254
de,bon332

 

Thank you in advance for your help

10 REPLIES 10
atcodedog05
22 - Nova
22 - Nova

Hi @NadaH 

 

Here is how you can do it.

 

Formula:

 

 

TrimRight(REGEX_Replace([A]+",", "(\b\w+\b,)\1+", "$1"),",")

 

 


Workflow:

 

atcodedog05_0-1628596762228.png

 

I am using regex for removing duplicate words.

 

Here is a weekly challenge which had a same kind of usecase https://community.alteryx.com/t5/Weekly-Challenge/Challenge-130-Is-There-an-Echo-in-Here/td-p/206817 

 

Hope this helps : )

 

mceleavey
17 - Castor
17 - Castor

Hi @NadaH ,

 

This is simply achieved by splitting the data to rows on column A using the comma separator in the Text to Columns tool.

Then you use the sum to group it creating a unique combination (or the Unique tool) then using the sum tool to group again by the second and third columns, and concatenating Column A separated by comma:

 

mceleavey_0-1628596788098.png

 

This gives the following:

 

mceleavey_1-1628596810028.png

 

Workflow attached.

 

Hope this helps,

 

M.

 

 



Bulien

NadaH
6 - Meteoroid

Thank you for your formula.

 

When I use this formula it works on some rows like this one:

NadaH_1-1628598879969.png

 

 

But it doesn't work here:

NadaH_0-1628598839333.png

I have put the result on column newCCandOI , I should have "Hors scope" only one time

atcodedog05
22 - Nova
22 - Nova

Hi @NadaH 

 

Use this formula. I have adapted it.

 

TrimRight(REGEX_Replace([A]+",", "([\w\s]+,)\1+", "$1"),",")

 

 

 

Workflow:

atcodedog05_1-1628599272754.png

 

Hope this helps : )

NadaH
6 - Meteoroid

Thank you! It works 

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @NadaH 

Cheers and have a nice day!

NadaH
6 - Meteoroid

I just noticed that it didn't work on this example,

NadaH_0-1628600915042.png

 

Can you tell me what I can add to the formula .

Thank you

 

atcodedog05
22 - Nova
22 - Nova

Hi @NadaH 

 

Use this formula. Should cover most scenarios

TrimRight(REGEX_Replace([A]+",", "([^,]+,)\1+", "$1"),",")

 

Workflow:

atcodedog05_0-1628601121444.png

 

Hope this helps : )

 

NadaH
6 - Meteoroid

Thanks , Can you explain me the logic behind this formula or where I can found ressources to understand it?

Labels