Number Sequence / Dummy Data Table Generator in Power Query M

Generates a table of sequential numbers, useful as dummy test data or a base table to join against.

Advanced M FunctionsBeginnerdummy datasequencegeneratortest data

Power Query M code

let
    Source = List.Numbers(1, 1000),
    ToTable = Table.FromList(Source, Splitter.SplitByNothing(), {"Number"}),
    ChangedType = Table.TransformColumnTypes(ToTable, {{"Number", Int64.Type}})
in
    ChangedType

Notes

List.Numbers(1, 1000) generates 1 through 1000; use List.Numbers(1, 1000, 1) for a custom step.

Requirements

How to use this snippet

  1. In Power BI Desktop, choose Transform data to open Power Query, then open the Advanced Editor on a query (or start from a blank query).
  2. Paste the snippet and replace the placeholder names (tables, columns, file paths) with your own. Check the requirements above first.
  3. Run it through the Power Query M Formatter to tidy the layout.

Related Power Query M snippets

More Power Query M resources

Browse all 145 snippets in the Power Query M Code Snippets, or search the library for something similar to Number Sequence / Dummy Data Table Generator.