Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #154: Permute the Data

JoeM
Alteryx Alumni (Retired)

Last week's solution can be found here.

 

This week's solution is working to permute some data!  This challenge is derived from an question asked by @iellingsonbg, and was solved by the illustrious @MarqueeCrew@MarqueeCrew then messaged us letting us know a great challenge was available that we should tackle! If you ever have a great challenge of your own or see another problem around the Community worth tackling, let us know!

 

As for the challenge itself, we are presented the options (tools). What we would like to do is determine all the combinations these tools can exist in an 'on/off' state. For three options we can see the following combinations. Note that the end result data is not formatted this way, but simple formatted here for ease of understanding.

Browse Input Output
Off Off Off
Off Off On
Off On Off
Off On On
On Off Off
On Off On
On On Off
On On On

 

If you want to take a more difficult route, try to setup your workflow where it would be dynamic to handle more than three tool options and more toggle options than on/off!

MarqueeCrew
20 - Arcturus
20 - Arcturus

@JoeM,

 

Illustrious is very kind of you.  I'll defer posting a solution until the real challenge guru's come up with some interesting alternatives.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
patrick_digan
17 - Castor
17 - Castor

I had a little bit of a headstart as I tried to solve @iellingsonbg's original problem. Thanks @MarqueeCrew for putting this as a weekly challenge!

Spoiler
I've successfully overcomplicated another weekly challenge. I turned this into a pure math problem. For the original problem, I set this up where 0 = Off and 1 = On.
BrowseInputOutput
000
001
010
011
100
101
110
111

So there's 8 rows of data since 2 toggles (ON/OFF) to the power of 3 items (Browse/Input/Output)  = 8. Then I realized that if I combined all the columns into 1 column, this is basically counting up in binary (base 2) with extra zeros padded to the left. Row 1 = 000(binary)= 0(decimal), Row 2 = 001(binary)=1(decimal), Row 3 =010(binary)=2(decimal). So now my table looks like this:
BrowseInputOutputBinaryDecimal
0000000
0010011
0100102
0110113
1001004
1011015
1101106
1111117

So to solve the problem, I generated my 8 rows of data with a simple recordID. Then I converted the recordID from Decimal to Binary. I created an iterative macro to do the conversion. 

Note that my macro will scale to any number of tools and toggles. You basically just need to convert the recordID from Decimal (base 10) to base x (where x= number of toggles) which is what it's doing. 
Capture.PNG

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@patrick_digan,

 

How horizontal of you!  Have you switched axis?  I haven't noticed before.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
patrick_digan
17 - Castor
17 - Castor

@MarqueeCrew I've finally given in on the weekly challenges. In my younger days I would change the weekly challenge to vertical before starting. I get along with @JoeM on most things but canvas layout direction is one we don't agree on. #Vertical.

MarqueeCrew
20 - Arcturus
20 - Arcturus

@patrick_digan next I'll be seeing you sitting next to me on an airplane!

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
JoeM
Alteryx Alumni (Retired)

@patrick_digan

N

o

t

 

e

v

e

r

y

t

h

i

n

g

 

h

a

s

 

t

o

 

b

e

 

v

e

r

t

i

c

a

l

MarqueeCrew
20 - Arcturus
20 - Arcturus
                          b i k e
                       r            j
                    u                 u
              y o                        m
           t                                  p
         s                                       s.  R i g
       u                                                      h t
     J                                                              ?

@JoeM  

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Ladarthure
14 - Magnetar
14 - Magnetar

Nice one, did a brute force way, but trying to find out a macro solution :)

danilang
19 - Altair
19 - Altair

High School Math to the Rescue! 

 

 

Thanks for the challenge @MarqueeCrew 

 

Spoiler
Scalable solution that handles varying number of tools! Not varying toggle options though!  That will have to wait for a generic base-N macro. 

Edit:  @patrick_digan IntToBin() does most of the heavy lifting.  But then again you have the Base-N macro that I still have to work on! DOH!


Solution.png

Dan