Expand Rows
Expand Rows turns each row into many: one for each step between a start and end column, or a fixed number per row. The other columns repeat on every new row.
Turn bookings into dates
Manual Input holds two bookings with check_in and check_out dates. Expand Rows creates one row per day between them, in a new date column.
Expand Rows interactive example
Loading interactive example…
The live example needs a desktop screen. The result it produces is shown here, and the explanation and settings below work on any screen.
| guest | check_in | check_out | date |
|---|---|---|---|
| Ada | 2025-03-01 | 2025-03-03 | 2025-03-01 |
| Ada | 2025-03-01 | 2025-03-03 | 2025-03-02 |
| Ada | 2025-03-01 | 2025-03-03 | 2025-03-03 |
| Lin | 2025-03-02 | 2025-03-02 | 2025-03-02 |
- Look at the preview. Ada's booking becomes three rows, March 1 to 3. Lin's starts and ends on the same day, so it stays one row.
- Change Stop to
Exclusive. Ada now has two rows, because her end date is dropped. Lin's row disappears, because her end date is also her only date.
When to use
Use Expand Rows when a row describes a period or a quantity that you need to count one by one, such as a booking from check-in to check-out. To create a single series with no input table, use Sequence. To split a text list into rows, use Split to rows.
To create one series with no input, use Sequence.
To split a text list into rows, use Split to rows.
Inputs and outputs
Inputs
1 port- InRequired
Accepts: Tables, Geospatial data.
Accepts one connection on this port.
Outputs
1 port- Out
Configure the block
- Mode
Expand between two columns, or by a fixed count per row. Other columns repeat on every generated row. A row whose end is before its start is dropped; a null start or end yields a single row with a null value.
Default:
Between columnsOptions: Between columns, Fixed count.
- Start
Column holding the range start; date, timestamp or number.
- End
Column holding the range end; same family as Start.
- Every
Step size, combined with the unit.
Default:
1- Unit
Calendar unit for the step. Month, quarter and year clamp to the end of shorter months.
Default:
dayOptions: day, week, month, quarter, year.
- Step
Numeric increment between values; must be greater than zero.
Default:
1- Stop
Inclusive keeps an end value that lands on the series; Exclusive drops it.
Default:
InclusiveOptions: Inclusive, Exclusive.
- Count from
A fixed value, or a per-row count column.
Default:
ValueOptions: Value, Column.
- Rows per input
How many rows to generate for each input row.
Default:
5- Count column
Numeric column giving the per-row count.
- Output Column
Name of the generated column; leave empty for value (between) or n (fixed count). Reuse the Start column name to replace it in place.
- Max Rows
Safety limit; the block errors if the expansion would exceed it.
Default:
10000000
Expand Rows FAQs
- What if a row's end is before its start?
- The row is dropped.
- What if the start or end is missing?
- The row stays as a single row with a null in the generated column.
- What does Max Rows do?
- It's a safety limit. The block reports an error if the expansion would exceed it.
Prepare your data. Build it in Strata.
Strata opens in your browser, with no account.