Skip to content

Sequential Functions ​

A handful of Set Instructions don't act on their own - they act as a modifier on whichever instruction comes immediately after them in the stack. Rather than taking a fixed argument, they borrow their target or criterion from the next line, which is why order is even more important with these than with most instructions.

This pattern shows up across several categories:

InstructionModifies
Expand Next InstructionExpands whatever element(s) the next instruction adds.
Collapse Next InstructionCollapses whatever element(s) the next instruction targets.
Remove Items Using The Next InstructionRemoves from the working list whatever the next instruction specifies.
Sort By Value Using The Next Instruction (Ascending) / (Descending)Sorts using the value the next instruction produces (typically a measure or formula).
Group By Value Using The Next Instruction (Ascending) / (Descending)Groups using the value the next instruction produces, inserting blank rows between groups.
Format Items Using The Next InstructionApplies formatting only to the element(s) the next instruction specifies.
Set Default Using The Next InstructionMarks the element the next instruction adds as the default selection.

The instruction that follows isn't optional ​

Because these modifiers borrow their meaning from the very next line, a "Using The Next Instruction" modifier with nothing meaningful after it - or followed by an instruction that doesn't produce the kind of value it expects - won't do anything useful. For example, Sort By Value Using The Next Instruction (Descending) expects the next instruction to produce a value (a measure reference or formula); following it with a name-based sort instead won't sort by value at all.

Each of these instructions is documented individually under the category it's most associated with (Set Formatting, Set Manipulation, or Data Formatting) - this page exists to name the pattern, since recognising "this is a next-instruction modifier" is often the fastest way to debug a set that isn't resolving the way you expect.