OpenBI Docs Buy

List.Alternate

Every so many items of a list: skip some, keep some, over and over.

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

Syntax

List.Alternate(list as list, count as number, optional repeatInterval as nullable number, optional offset as nullable number) as list
ParameterTypeDescription
listlistThe list.
countnumberHow many items to skip each time.
repeatIntervalnullable number
optional
How many items to keep between skips; without it, only the first count items are skipped.
offsetnullable number
optional
How many items to keep at the start before skipping begins.

Returns

list. The items kept.

Examples

Without the subtotal lines

List.Alternate({"Coffee", "Subtotal", "Tea", "Subtotal", "Milk", "Subtotal"}, 1, 1, 1)
{"Coffee", "Tea", "Milk"}

Skip two, keep three

List.Alternate({1..10}, 2, 3)
{3, 4, 5, 8, 9, 10}

List.Select, List.Skip, Table.AlternateRows.

Last updated · OpenBI Studio 0.3.79