Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
ALTER.NEXT:

Join us on Dec 2 for a half-day virtual analytics + data science event!
US & CA customers only

SAVE YOUR SPOT
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!
SOLVED

Filter out Values with multiple Dashes

Highlighted
8 - Asteroid

Hey everyone,

 

I have a field with values that contain one dash and some values contain multiple dashes. For example:

 

Name

James - Smith

Ryan - Jones

Dylan_ James - English - Burke

Elizabeth - kelly - Steve

 

How can I filter out the values that have multiple dashes? Any help would be greatly appreciated. Thank you!

Highlighted
14 - Magnetar
14 - Magnetar

Hi @Chirag_Gandhi07 ,

 

You could use a filter, with a Custom filter based on counting the number of hyphens. The REGEX_CountMatches function can count the number of hyphens. Those rows that have more than one will flow through the T output and those with only one through the F output in the below exampleimage.png

 

Cheers!

Esther

17 - Castor
17 - Castor

Hi @Chirag_Gandhi07 

 

You can use REGEX_CountMatches in a formula tool and then filter on the result

 

Solution.png

 

Dan

Highlighted
14 - Magnetar
14 - Magnetar

Great minds think alike, @danilang !!

 

You can either step out into two tools, using a formula and filter, or put the formula directly into the filter.

Highlighted
8 - Asteroid

@EstherB47 @danilang Thank you both!!

Highlighted
8 - Asteroid

@EstherB47 @danilang For the values with multiple dashes, do either of you know how I could filter out values based on the name after the last dash of the value? For example:

John - James - Smith

 

I would like to filter out the names that end in Smith. Now some of the values could have Smith as middle name. I only want to filter out the values that have Smith as a last name.

Highlighted
17 - Castor
17 - Castor

hi @Chirag_Gandhi07 

 

Add in a filter with the following config

 

Smith.png  

".*" matches any number of character and "Smith$" matches "Smith" but only at the end of a line(The "$" modifier).

 

Dan  

Highlighted
8 - Asteroid

@danilang Thank you. One last question, I want to split the values into to columns. For example:

John - James - Smith

 

I would like to split it up to two fields:

 

John - James

 and

- Smith

 

Thanks again. Really appreciate the help! Not really familiar with REGEX

Labels