Round Robin / All possible Pairs from List

tobiasgysel
New Contributor

Round Robin / All possible Pairs from List

Good afternoon (and sorry if this is a real beginner's question),

 

I have a quick question regarding Anaplan's functionality. I was wondering whether it is possible to extract all possible pairings from a list (e.g. across the dimension of playing rounds), so that each list item is paired with another exactly once, resulting in a round robin style tournament. e.g. a list of 13 players, each of them facing each other once in a pairing, which then can be visualized on a dashboard across 12 rounds.

 

Any idea in how to proceed?

 

Best regards and thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
JohnP
Occasional Contributor

Hi @tobiasgysel,

 

This is an interesting question. I've put my first attempt below, but there are probably much easier (and more efficient) ways.

 

Firstly you start with a list of your players e.g. ‘List 1’ with a code like the one below (i.e. a code with a unique numeric component):

JohnP_0-1643109915087.png

You then make an identical duplicate of this list, e.g. ‘Duplicate List 1’. This list should contain identical items with identical codes; the unique numeric component should match that of the same item in the original list. (If you were to follow best practice, the duplicate code wouldn't be the same as the original code but in this instance it shouldn't matter too much.

Create a system module for each list and include a line item that converts the numeric part of the code into a value:

JohnP_1-1643198669621.png

 

Create an output module the two lists as the dimensions and three line items:

  • Valid Pair: this is a Boolean-formatted line item which removes pairings of the same item and duplicate pairings, formula: 'SYS01 List 1 Details'.Value <> 'SYS02 Duplicate List 1 Details'.Value AND 'SYS01 List 1 Details'.Value < 'SYS02 Duplicate List 1 Details'.Value . (If the numeric components of the codes are not the same in both lists, this will remove the wrong pairings.)
  • Pair Name: text-formatted line item that creates a name for the pair, formula: NAME(ITEM('List 1')) & " & " & NAME(ITEM('Duplicate List 1'))
  • Pair Code: text-formatted line item that creates a code for each pair, formula: CODE(ITEM('List 1')) & "." & CODE(ITEM('Duplicate List 1'))

Then create a saved view showing the list of pairs with the pair name & code line items, filtered by 'Valid Pair': 

JohnP_0-1643197478798.png

Run an import to create a list of pairs using the above saved view to populate the name and code. You should be able to reference the original player items by breaking down the pair code.

This should work fine for smallish lists but obviously might cause problems with larger lists as the output module size is proportionate to the number of list items squared.

 

Hope this helps!

 

Best, 

John

View solution in original post

1 REPLY 1
JohnP
Occasional Contributor

Hi @tobiasgysel,

 

This is an interesting question. I've put my first attempt below, but there are probably much easier (and more efficient) ways.

 

Firstly you start with a list of your players e.g. ‘List 1’ with a code like the one below (i.e. a code with a unique numeric component):

JohnP_0-1643109915087.png

You then make an identical duplicate of this list, e.g. ‘Duplicate List 1’. This list should contain identical items with identical codes; the unique numeric component should match that of the same item in the original list. (If you were to follow best practice, the duplicate code wouldn't be the same as the original code but in this instance it shouldn't matter too much.

Create a system module for each list and include a line item that converts the numeric part of the code into a value:

JohnP_1-1643198669621.png

 

Create an output module the two lists as the dimensions and three line items:

  • Valid Pair: this is a Boolean-formatted line item which removes pairings of the same item and duplicate pairings, formula: 'SYS01 List 1 Details'.Value <> 'SYS02 Duplicate List 1 Details'.Value AND 'SYS01 List 1 Details'.Value < 'SYS02 Duplicate List 1 Details'.Value . (If the numeric components of the codes are not the same in both lists, this will remove the wrong pairings.)
  • Pair Name: text-formatted line item that creates a name for the pair, formula: NAME(ITEM('List 1')) & " & " & NAME(ITEM('Duplicate List 1'))
  • Pair Code: text-formatted line item that creates a code for each pair, formula: CODE(ITEM('List 1')) & "." & CODE(ITEM('Duplicate List 1'))

Then create a saved view showing the list of pairs with the pair name & code line items, filtered by 'Valid Pair': 

JohnP_0-1643197478798.png

Run an import to create a list of pairs using the above saved view to populate the name and code. You should be able to reference the original player items by breaking down the pair code.

This should work fine for smallish lists but obviously might cause problems with larger lists as the output module size is proportionate to the number of list items squared.

 

Hope this helps!

 

Best, 

John