Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power BI Table Limit Rows Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Power BI Desktop does not strictly enforce a hard limit on the number of rows in a table, but performance degrades significantly once datasets grow beyond 1–2 million rows. The fastest way to enforce a limit is to filter your data directly within the Power Query editor using the "Remove Top Rows" feature before loading it into the report.

What You'll Need

  • A computer with Power BI Desktop installed.
  • Access to the source data (Excel, CSV, SQL database, etc.).
  • A basic understanding of the Power Query editor interface.

Step-by-Step

  1. Open Power BI Desktop. Launch the application and navigate to the Home tab on the ribbon. Click on Get Data to connect to your source. Select your data source type (e.g., Excel Workbook, CSV, SQL Server) and follow the prompts to import the data into the Power Query Editor. Do not click "Load" yet; you must edit the query first.
  2. Locate the data query. Once the data appears in the Power Query editor, look at the left-hand pane under the "Applied Steps" section. You will see the step where your data was loaded, often named "Source" or the name of your file/database. This is the query you will modify.
  3. Open the Advanced Editor (Optional but Recommended). For precise control, it is often easier to write the limit directly in the Advanced Editor. Click the Advanced Editor button on the Home tab. This opens a window showing the M code that defines your query. Locate the line where the data is retrieved (e.g., Excel.Workbook(...) or Sql.Database(...)) and note the table index if necessary.
  4. Apply a Top-N filter. The most common method is to remove the excess rows. In the query editor, right-click the column header containing your primary key or unique identifier (usually an ID column). Select Filter Rows and then Top Rows. A dialog box will appear asking for the number of rows to keep. Enter a specific number (e.g., 500,000) or a percentage (e.g., 10%). This will remove everything below that threshold.
  5. Use the Advanced Editor for syntax-based filtering. If you prefer code, you can modify the M query to use the List.FirstN function. The general syntax looks like this: Table.FirstN(Source, 100000). This function takes the source table and returns only the first 100,000 rows. This method is useful if you need to keep the bottom rows instead of the top rows.
  6. Load the data. Once you have applied the filter and removed the unwanted rows, click the Close & Apply button in the ribbon. Power BI will process the query, apply the row limit, and load the resulting table into the report view. The dataset will now be much faster to interact with.

Common Mistakes

One frequent error is attempting to filter the data *after* it has been loaded into the report view (using a slicer or a filter pane). While you can use a slicer to limit the rows shown to a user, this does not reduce the file size or the memory usage of the model. The dataset remains fully loaded in the background, which can still cause sluggish performance on large datasets. Always filter in Power Query to reduce the data footprint before loading.

Tips

  • Identify the bottleneck. Before applying a limit, use the "Data View" in Power BI to check the size of your tables. If a single table contains millions of rows, it is the primary cause of slow performance. Target that specific table for filtering.
  • Use a sample for prototyping. When building a report, load only a small sample (e.g., 10,000 rows) from your data source. This allows you to build visuals and relationships quickly. Once the report is stable, you can switch to a larger dataset or apply a limit to a specific column.
  • Consider aggregations. If you need to analyze trends over a long period, consider aggregating data by day or week rather than keeping every transaction. This reduces the row count by orders of magnitude while preserving the overall trend information.
  • Check for hidden tables. Sometimes, a calculated table or a DAX measure generates a massive table behind the scenes. Ensure you are not creating a new table inside Power Query that pulls from a massive source without a limit.

Troubleshooting

If the data is not limiting as expected, the issue is usually due to the data type or the query structure.

The data is still huge after filtering.

If you applied a filter but the table size hasn't changed, check the data types. Sometimes, a column that looks like an integer is actually a text column. If the data is text, the Top Rows filter might not work as intended because it cannot sort text alphabetically to find the top N physical rows. Go to the Transform tab and change the data type to Whole Number or Decimal Number to ensure the filter can sort the data correctly.

I get an error when using Advanced Editor.

Ensure that the syntax you are entering is correct. In M code, commas separate arguments. If you are using a function like Table.SelectRows, make sure you are providing a predicate function that returns a boolean. A common mistake is forgetting the closing parenthesis for the function. Also, ensure you are editing the correct query in the Advanced Editor.

Performance is still slow.

If the row limit has been applied but the report is still slow, the issue may be with relationships or visuals. If you have a table with 50,000 rows, a scatter plot with thousands of points will be slow. Try simplifying the visuals or removing unnecessary relationships between tables.

Frequently Asked Questions

Does Power BI have a maximum row limit for tables?

No, there is no hard maximum row limit in Power BI Desktop. You can import millions of rows, but performance will suffer significantly. For optimal performance, it is recommended to keep datasets under 1 million rows for standard desktop use.

Can I change the row limit for a live connection?

Yes, you can change the limit in the source query if you have access to modify the Power Query steps. However, if you are using a live connection to a SQL Server or Analysis Services cube, the limit is enforced by the source database, not Power BI. You must modify the query on the database side.

Does removing rows in Power Query affect the source file?

No. Power Query creates a new, filtered version of the data in memory. It does not modify your original Excel file, CSV, or database table. Your source data remains completely untouched.

How do I limit rows by date instead of a count?

You can use a filter to keep only the rows where the date column is greater than or equal to a specific date. For example, use the "Filter Rows" > "Keep Rows" option and select "Date is Greater Than or Equal To" and choose your cutoff date.

Why is my Power BI file so large?

A large file size is usually caused by a large number of rows, large text columns, or the inclusion of multiple large tables. Removing unused columns and limiting the number of rows in Power Query are the two most effective ways to reduce file size.