Alteryx designer Discussions

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

Removing partial string from data

Highlighted
8 - Asteroid

I want to remove the text "Total" from any row that contains it in a specific field. But I want to keep any text before and after.

How can I do this?

Highlighted
14 - Magnetar
14 - Magnetar

Hey @MPCNA!

 

This is easy with the Replace function. Add a Formula tool and use the following expression:

Replace([Field1], "Total", "")

This is saying find "Total" and replace it with nothing.

 

RegEx also provides a great way to solve this problem if you're interested in a simple case to learn this expression. Add this to a normal Formula tool:

REGEX_Replace([Field1], "(.*)(Total)(.*)", "$1$3")

Each set of parenthesis is a group. This expression is saying keep groups 1 and 3.

 

Hope this helps!

8 - Asteroid

Hi BarnesK!

 

Thank you for the help! Plans changed in the few minutes since I posted. Now I am trying to figure out if there is a way to just filter out any fields that contain "Total" in them. I am trying to sum the data on Location but the "Total" fields are doubling all the sums. 

 

Highlighted
14 - Magnetar
14 - Magnetar

Hey @MPCNA

 

That's no problem. There is actually a built-in formula for that. In a Filter tool, use a custom filter with the following expression:

Contains([Field1], "Total")

Any record that contains "Total" will come out the T side and the rest will fall out the F.

Highlighted
Alteryx
Alteryx

Using Date Parse tool

 

nitinsnow_0-1575366438784.png

Labels