Dynamic Numeric and Date Sequences with the SEQUENCE Function
Generate custom number ranges, date series, and alphanumeric patterns in Power Apps using SEQUENCE – with practical examples and performance insights.
The SEQUENCE function has quietly become one of the most useful tools for generating structured data inside Power Apps. Instead of manually building a collection of numbers, you can now produce a single‑column table of values with a single formula – and from there create date ranges, alphabetical lists, padded IDs, and even random selections. This article explains the syntax, walks through a real‑world scenario, and shares tips to keep your apps lean.
Function Syntax at a Glance
SEQUENCE( Records [, Start [, Step ] ] )
- Records (Required) – The number of rows you want in the table.
- Start (Optional) – The first value of the sequence. Default is 1.
- Step (Optional) – The amount added to each successive row. Default is 1.
The result is a single‑column table with the column name Value.
The simplest call: Sequence(5) returns [1, 2, 3, 4, 5].
To start at 100 and count down by 10: Sequence(5, 100, -10) returns [100, 90, 80, 70, 60].
The Records count must be in the range 0 to 50,000. Fractional values are rounded down (e.g., Sequence(0.9) returns an empty table).
Building a Dynamic Schedule – A Step‑by‑Step Example
Imagine you are creating a training tracker for a logistics company. Each training session must have a unique ID (like TR-101, TR-102, …) and a scheduled date that falls on the first Monday of the next 10 weeks.
First, store the start date in a variable:
Set(StartMonday, Date(2026, 6, 8)); // adjust as needed
Then use Sequence(10) to generate the row numbers and ForAll to combine them with calculated dates:
ClearCollect(
TrainingSessions,
ForAll(
Sequence(10),
{
SessionID: "TR-" & Text(100 + Value, "000"),
ScheduleDate: DateAdd(StartMonday, (Value - 1) * 7)
}
)
);Result – a collection with 10 records:
TR-101,2026-06-08TR-102,2026-06-15- … up to
TR-110,2026-08-10
Practical Sequence Patterns
Numeric
Generate every number from 0 to 100 in steps of 10:
Sequence(11, 0, 10)
Create a descending list of odd numbers from 19 down to 1:
Sequence(10, 19, -2)
Date
Produce the first day of each quarter in 2026. The quarter-start months are 1, 4, 7, 10 — a sequence starting at 1 with a step of 3:
// Produces: Q1 Jan 1, Q2 Apr 1, Q3 Jul 1, Q4 Oct 1
ForAll(
Sequence(4, 1, 3),
{
QuarterLabel: "Q" & Text(RoundUp(Value / 3, 0)),
StartDate: Date(2026, Value, 1)
}
)The RoundUp(Value / 3, 0) maps month numbers 1→Q1, 4→Q2, 7→Q3, 10→Q4, giving readable quarter labels instead of raw month numbers.
List the next 14 days (including today) and filter out weekends:
// Show only Monday–Friday in the next two weeks
Filter(
ForAll(Sequence(14), {Date: Today() + Value}),
Weekday(Date) in [2,3,4,5,6]
)Alphabet
Obtain the letters A–Z:
ForAll(Sequence(26), Char(64 + Value)).Value
Combine this with numeric padding to build product codes like CAT‑A01:
ForAll(
Sequence(5, 1, 1),
{
ProductCode: "CAT-" & Char(64 + Value) & Text(Value, "00")
}
)Random (without Duplicates)
Need 10 unique random numbers between 1 and 100? Shuffle the whole sequence and take the first rows:
Take(Shuffle(Sequence(100, 1, 1)), 10)
Performance and Delegation
- SEQUENCE is evaluated on the server only when its result is passed to a delegable data source. However, if you use it inside
ForAllthat writes to a collection, all work happens client‑side. - Very large sequences (e.g.,
Sequence(5000)) can slow down the app, especially when combined withForAll. Keep the Records parameter below a few hundred unless your scenario absolutely requires more. - When generating a single random value, prefer
Rand()orRandBetween()directly – they are lighter thanFirst(Shuffle(Sequence(…))).
A sequence of 10 000 rows will consume significant memory and may cause the app to become unresponsive. Always test with a realistic maximum.
Avoiding Common Mistakes
- Forgetting the column name – The resulting table uses
Valueas its column. In galleries orForAll, refer toThisRecord.Valueor justValuewhen the scope is clear. - Assuming a scalar return –
Sequence(1)still returns a table, not a number. UseFirst(Sequence(1)).Valueto get a single numeric value. - Non‑whole steps –
0.5works, but be aware that number formatting in labels might need theTextfunction for clean display. - Step direction – If you specify a negative step, make sure Start is logically consistent (e.g., start at 10, step -1).
Final Thoughts
SEQUENCE replaces many manual Collect loops and lets you craft dynamic lists of numbers, dates, and codes with remarkable brevity. Whether you need a simple index for a gallery or a full calendar of future Fridays, this function makes the task clean and maintainable.
For performance, keep the record count reasonable and test with your largest expected data set. When combined with ForAll, Filter, and date arithmetic, SEQUENCE becomes a foundation block for many data‑generation tasks.
References
- Original reference: Power Apps SEQUENCE Function by Matthew Devaney
- Official Microsoft documentation (when available): SEQUENCE in Power Fx
Learn how small coding practices—like using descriptive names, flattening conditions, and simplifying logic—can make your apps easier to update and less error-prone.
Move past the gallery and discover the hidden patterns for validation, navigation, and smart submission handling in your data entry forms.
PowerShell unlocks admin capabilities that the Power Platform admin center simply doesn’t offer—from recovering deleted apps to blocking trial licenses. Here’s how to wield them safely.