OpenBI Docs Buy

Number.Combinations

How many ways there are to choose a number of items from a set, when the order of the choice doesn't matter.

Group: Number. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Number.Combinations(setSize as nullable number, combinationSize as nullable number) as nullable number
ParameterTypeDescription
setSizenullable numberHow many items there are to choose from.
combinationSizenullable numberHow many to choose.

Returns

nullable number. The count of different selections; 0 when more are chosen than there are.

Remarks

  • Both numbers must be whole and not negative: a fraction or a negative number is an error. null gives null.
  • Large counts are numbers like any other, kept to about 15 significant digits.

Examples

Two-product bundles from five products

Number.Combinations(5, 2)
10

Chair with desk is the same bundle as desk with chair.

Choosing more than there are

Number.Combinations(5, 6)
0

Number.Permutations, Number.Factorial.

Last updated · OpenBI Studio 0.3.79