Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Binary Search

mark_paul
8 - Asteroid

Hi,

 

How to achieve binary search (If exact match pick exact value else closest Upper value. If Upper value is not available the pick the lower value) in Alteryx?

 

idPeriodvalue
1002Upper Period 3 value-0.8765
1014Exact Match period 4-1.3654
1027upper period 8 value
10310lower period 8 value

 

 

Lookup Data

PeriodValue
30.8765
41.3654
81.3654

 

 

Thanks,

Mark

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus

@mark_paul ,

 

 what you'll need to do is GENERATE ROWS on the table. Create all possible periods and the join to the results. 3 becomes 1,2,3. 4 becomes 4,5,6. 7 becomes 7,8,9. 10 goes to max. 

cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
mark_paul
8 - Asteroid

@MarqueeCrew , Could you send me the sample workflow?

 

Thanks,

Mark

afv2688
16 - Nebula
16 - Nebula

Hello @mark_paul,

 

This should do it:

 

Untitled.png

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Regards

Labels
Top Solution Authors