COMBIN
The number of ways to choose a number of items from a set, order not counting.
Group: Math. Compatible with DAX.
Syntax
COMBIN ( <number>, <number_chosen> )
| Parameter | Type | Description |
|---|---|---|
number | Whole number | How many items there are to choose from. |
number_chosen | Whole number | How many of them are chosen. |
Returns
Number. How many different groups of that size can be picked, the order inside a group not counting.
Remarks
- From five beers,
COMBIN ( 5, 2 )gives the 10 different pairs. - Both numbers are rounded to whole numbers first, a half away from zero: 5.5 counts as 6, so
COMBIN ( 5.5, 2 )gives 15. - Choosing none or all gives 1. A negative number, or choosing more items than there are, is an error.
- When the order counts, use
PERMUT; when an item may be picked more than once,COMBINA.
Examples
Pairs, poker hands and a rounded count
EVALUATE
ROW (
"Pairs of 5", COMBIN ( 5, 2 ),
"Hands of 5 from 52", COMBIN ( 52, 5 ),
"Of 5.5, 2", COMBIN ( 5.5, 2 )
)
| Pairs of 5 | Hands of 5 from 52 | Of 5.5, 2 |
|---|---|---|
| 10 | 2598960 | 15 |
Three ways to count three of ten
EVALUATE
ROW (
"COMBIN", COMBIN ( 10, 3 ),
"PERMUT", PERMUT ( 10, 3 ),
"COMBINA", COMBINA ( 10, 3 )
)
| COMBIN | PERMUT | COMBINA |
|---|---|---|
| 120 | 720 | 220 |