Alteryx Designer Desktop Discussions

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

Removing partial string from data

MPCNA
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?

4 REPLIES 4
Kenda
16 - Nebula
16 - Nebula

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!

MPCNA
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. 

 

Kenda
16 - Nebula
16 - Nebula

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.

nitinsnow
Alteryx Alumni (Retired)

Using Date Parse tool

 

nitinsnow_0-1575366438784.png

Labels