Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
Ladarthure
14 - Magnetar
14 - Magnetar

Secret Santa is something organized among friends or even some companies. It’s something nice and quite easy to organize by using Alteryx.

 

Here are 2 methods you can use if you need to organize this kind of event or to extend to more generic use cases, create pairings between a group of people.

 

First Method

 

The first method is the one I originally used to make this workflow.

 

To make it work, you need to sort all your records by a random number. You can generate 2 random numbers. Then you can create a record ID (eventually split by group) to finally join data by group and record ID.

 

Secret Santa 1.png

 

The main problem with this method is that someone (or a record) can be matched with him/her/itself if, by chance, if this record is sorted at the same place. To make sure the process is working fine within Alteryx, I added a message tool to test records. If any record is different, it will throw an error in the workflow.

 

To summarize, this method, even if working, can be quite unreliable in some cases. For instance, you may have to run it multiple times before it gives you a result working. The good point is that you can match with someone who can match with you on the other side (which won't be handled by the second method).

 

Second Method

 

This method has been proposed to me by a colleague @Jean-Balteryx, after explaining what issue I ran into. He told me that I could have done it with another tool and decided to give it a shot.

 

The second method consists of sorting all your data by a random number (no big difference at the moment) and then pairing people with the previous row. The only thing you need to handle is having this for the first person on the list, who will have to be paired with the last person on the list and then bring all the data back together.

 

Secret Santa 2.png

 

The good point with this method is that it's more reliable--there is no risk of having a pair of the same values, no multiple runs (in my case), and it is able to handle all the cases I've been thinking of. The only drawback (not major to my mind, though) is that a match like the below would not be possible :

  • Person A matches Person B

  • Person B matches Person A

 

Methods Comparison

 

Both methods work, but the second method is more reliable. What could have been done also would be to encapsulate the process into an iterative macro.

 

Improvements

 

The process could be upgraded by including some Reporting tools for directly sending messages to the people and telling them who they are giving a gift to! It's a great way to exercise and discover the Reporting tools using Alteryx.