Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Reversing values

SimJB
5 - Atom

I'm fairly new to Alteryx and i'm trying to fix something simple. i have a column in which there are values ranging from 1-5. i simply want to reverse them, as in replace the 1s with 5s, 2s with 4s and so on and so forth. How do i do this?

 

Current Column
1
2
4
4
5
5
3

   

 

Desired Column
5
4
2
2
1
1
3
5 REPLIES 5
ThizViz
11 - Bolide

I would use the Table Tool to create a table like this:

 

Old ValueNew Value
15
24
33
42
51

 

Then join to your data using "Old Value" as the join field and use the "New Value" column to continue with your workflow.

@thizviz aka cbridges, Bolide
http://community.alteryx.com/t5/user/viewprofilepage/user-id/2328
LandonG
8 - Asteroid

ThizViz, do you mean this could be accomplished using the text input tool?

danilang
19 - Altair
19 - Altair

Hi SimJB

 

The solution from @ThizViz will work, but a more generic one would be to find the maximum of the values in the [Current column] and then use a formula to compute the values in the [Desired Column].  This will work with any number and range of values, without having to build the lookup table manually

 

Solution.png

Dan

SimJB
5 - Atom

This is great, thanks! Right after I posted this query, I stumbled upon the switch tool and it worked, although the suggestions I received on this thread are far more elegant. I have another task at hand where I have to replace numeric values in a column with string values. It will essentially work in the same manner, where there are two tables. 1 will be replaced with Africa, 2 will be replaced with Americas and so on and so forth. I think the solution you provided should work in this situation as well. Is it possible to show this as an alteryx workflow, it would be super helpful. Thanks!

 

 

ThizViz
11 - Bolide

Yes, that's what I meant, sorry.

@thizviz aka cbridges, Bolide
http://community.alteryx.com/t5/user/viewprofilepage/user-id/2328
Labels