We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Fill out a column contingent on other values

ericren
8 - Asteroid

Hi Alteryx Community.

 

I need some help with this problem. 

I have the below input.

 

Ratio 1 Ratio 2 Fruit 1Fruit 2
21OrangeApple
1.53BananaPineapple

 

And I want the below output.

 

MAX RATIOFruit
2Orange
3Pineapple

 

 

Basically I want to take the Fruit to be based on which Ratio is larger. 

If ratio 1 is larger I want the Fruit from Fruit 1.

If ratio 2 is larger I want the Fruit from Fruit 2.

 

 

 

 

Thank you

7 REPLIES 7
ericren
8 - Asteroid

I'm thinking using formula tool with something like. 

 

If(Ratio 1 > Ratio 2) then Fruit 1

If(Ratio 1 < Ratio 2) then Fruit 2

 

Can someone comment on this please.

DataNath
17 - Castor
17 - Castor

Hey @ericren, if it's only the 2 fields (for each of fruit and ratio) that you're comparing then yep, you could use an approach like so:

 

DataNath_0-1668547513820.png

davidskaife
14 - Magnetar

Hi @ericren 

 

Something simple like this in the Formula tool will work for you; This way you can define what happens if neither check is true (for example if you're ratios are identical). I've set them to display 0 and null respectively but you can have them set to whatever you like.

 

DavidSkaife_0-1668547541615.png

DavidSkaife_1-1668547601787.png

 

 

Felipe_Ribeir0
16 - Nebula

Hi @ericren 

 

One way of doing it dynamically (for n fruits):

 

 

Felipe_Ribeir0_0-1668549996267.png

 

ShankerV
17 - Castor

Hi @ericren 

 

One way of reaching the solution

 

ShankerV_1-1668579981084.png

 

 

ShankerV_0-1668579963493.png

 

Kindly accept this solution if it provided a solution to your question.

 

Many thanks

Shanker V

 

flying008
15 - Aurora

Hi, @ericren 

 

There is a dynamic solution for you , if it can help you , please mark it as a solution and give a like.

 

录制_2022_11_16_15_31_12_805.gif

Felipe_Ribeir0
16 - Nebula

Hi @ericren 

 

It worked?

Labels
Top Solution Authors