Free Trial

Alteryx Designer Desktop Discussions

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

How to have a column that will utilize the following condition?

Hoss2434
7 - Meteor

Hello,

 

I have a column that I need to show if it contains more than 1 value from one column, while referencing another column. Below is a example of a before and after of what I want:

 

Before:

IDColor
1Red
1Red
2Blue 
2Red

3

Red
3Blue
3Red
4Blue

 

After:

IDColorContains Both Colors?
1RedNo
1RedNo
2Blue Yes
2RedYes
3RedYes
3BlueYes
3RedYes
4BlueNo

 

So in this example the third column is checking if the "ID" column is marked for both Colors in the second column. If that ID is marked for both Red and Blue, then in the third column it will state "Yes", otherwise "No".

If someone can show me how to create a formula for this that would be much appreciated!

 

Thanks!

4 REPLIES 4
BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@Hoss2434 here's one way:

BS_THE_ANALYST_0-1678742046957.png

 

Summarize tool is checking how many distinct colours there is for each ID. We then use the join tool to join back using ID. This will give us an extra column to build logic on:

BS_THE_ANALYST_0-1678742127742.png

Then we can write an if statement, i.e. if number of unique colours is greater than 1, then Yes, else No.

Thanks,
BS

 

All the best,
BS

LinkedIN

Bulien
BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@Hoss2434 another way using a slightly different logic:

BS_THE_ANALYST_0-1678742592861.png

Essentially, this way gives us a column that tells us all the colours that the ID holds. We can then create another column to check if it Contains the colours we're looking for:

BS_THE_ANALYST_1-1678742667669.png

 

Hope the solutions help 😎.

Thanks,

BS

 

All the best,
BS

LinkedIN

Bulien
BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@Hoss2434 admittedly, solution 2 is better than solution 1 😂

 

All the best,
BS

LinkedIN

Bulien
gaoa
11 - Bolide

Hi @Hoss2434 my solution (similar to solution 1):

gaoa_0-1678746626548.png

Labels
Top Solution Authors