In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more 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