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.

Formula tool question

Manjari
8 - Asteroid

Hi All, 

 

I have a table like below, I would like to apply a condition that if the columns Topic2 to Topic4 are the same as Topic1 then make them null else retain the same value.

For this requirement, I made created several if conditions for each of the columns. 

 

is there an easier way?

 

Topic1Topic2Topic3Topic4
SustainabilitySustainabilitySustainabilitySustainability
SustainabilitySustainabilitySustainabilitySustainability
SustainabilitySustainabilitySustainabilitySustainability
Climate changeSustainability  
4 REPLIES 4
cmcclellan
13 - Pulsar

I'd create a flag field that is something like this 

 

if [Topic2] = [Topic3] and [Topic3]=[Topic4] then 1 else 0 endif

 

Now you can put a formula on [Topic2]

 

if [flag] = 1 then null() else [Topic2] endif

 

and the same for Topic3 and Topic4

 

then all a Select to remove the flag 🙂 

atcodedog05
22 - Nova
22 - Nova

Hi @Manjari 

 

You can use Multi-field formula tool like below. Which will be applied on multiple columns.

 

atcodedog05_0-1633071576706.png

 

Hope this helps : )

atcodedog05
22 - Nova
22 - Nova

Hi @Manjari 

 

If this is not the expected output can you please provide more complex sample input and expected output it will help us get a better understanding of the usecase.

Ben_H
11 - Bolide

Hi @Manjari,

 

I would do it with a transpose then a cross tab as below.

Ben_H_0-1633081852003.png

Ben_H_1-1633081878710.png

 

This way you could add topic columns and it would handle them automatically, and you only need one simple formula.

 

See attached example.

 

Regards,

 

Ben

 

 

Labels