Hi,
Let me just show an example. I need to exaust all the possible combinations of three records from the list. I think iterative macro might help, by extracting 3 each time. But I am not sure how to code in this case. Any good idea?
And how about making all combinations of 2, 4, or 5 and so on?
Name1 | Value1 | RecordID | TotalRecords | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
A | 100 | 1 | 7 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | ||||||||||||||||||||
B | 150 | 2 | 7 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | ||||||||||||||||||||
C | 150 | 3 | 7 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | 150 | ||||||||||||||||||||
D | 201 | 4 | 7 | 201 | 201 | 201 | 201 | 201 | 201 | 201 | 201 | 201 | 201 | 201 | 201 | 201 | 201 | 201 | ||||||||||||||||||||
E | 51 | 5 | 7 | 51 | 51 | 51 | 51 | 51 | 51 | 51 | 51 | 51 | 51 | 51 | 51 | 51 | 51 | 51 | ||||||||||||||||||||
F | 30 | 6 | 7 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | ||||||||||||||||||||
G | 101 | 7 | 7 | 101 | 101 | 101 | 101 | 101 | 101 | 101 | 101 | 101 | 101 | 101 | 101 | 101 | 101 | 101 | ||||||||||||||||||||
400 | 451 | 301 | 280 | 351 | 451 | 301 | 280 | 351 | 352 | 331 | 402 | 181 | 252 | 231 | 501 | 351 | 330 | 401 | 402 | 381 | 452 | 231 | 302 | 281 | 402 | 381 | 452 | 231 | 302 | 281 | 282 | 353 | 332 | 182 |
Solved! Go to Solution.
I don't use it much, but have you tried the Permutation Tool on the Data Investigation palate?
@mbarone Hi, Which version you are using? I am using V2020.3.5 and do not have this Permutation Tool.
Hi @JokeFun
Here's a different take on the C(n,r) problem. The overall strategy expresses the values from 1 to 2^n as integers and then takes all the ones that have r bits set to 1. These combinations are joined to your original data to give you the groups. You get a large number of intermediate rows, but since they're generated iteratively as opposed to through a Cross Join the algorithm is very fast. The output is sorted by group and Input row
This is slight modification to my solution to Weekly Challenge 231, that allows you to specify the number of unique items in each group. Since @Kenda, who submitted the original challenge is a vertical User, my solution is also vertical
Dan
@danilang Hi Dan, This is really a great workflow! Actually I don't have much idea of the bin thing, or the 1/0 thing in the workflow. But I see it's absolutely a nice application of those concepts in Alteryx. Thank you very much!
Hi @Christina_H Thank you very much! This is really a simple but great workflow with clear logic. It really gives me many hints.