Count Rows Before and After a Power Query Filter
Use Table.RowCount on the original table and again on the filtered table to measure exactly how many records a Power Query filter removes. In this practice query, five workshop requests include three marked Ready and two marked Hold. The unfiltered count should be 5 and the filtered count should be 3. Keeping both values together makes a missing or unexpectedly strict filter easier to diagnose when the query changes.
Build the sample in a blank query
Open Power BI Desktop with a new practice file. Enter the Power Query editor using Transform data. Create a blank query, select it in the Queries pane, and open Advanced Editor. Replace the blank query’s script with the following five lines. If you paste one line at a time, keep the trailing commas on the first two assignment lines. Preserve the straight quotation marks around status values. A complete let expression can also be pasted on one line if your editor has flattened the displayed text.
let
Source = #table(type table [Ticket = text, Status = text], {{"W01","Ready"},{"W02","Hold"},{"W03","Ready"},{"W04","Hold"},{"W05","Ready"}}),
ReadyRows = Table.SelectRows(Source, each [Status] = "Ready"),
Counts = #table(type table [Stage = text, Rows = number], {{"Before filter",Table.RowCount(Source)},{"After filter",Table.RowCount(ReadyRows)}})
in Counts
After you accept the script, select the Counts step. The preview should have two rows with the stage labels Before filter and After filter. Read the Rows column for the values 5 and 3. This output table has two records of its own. Those two output records describe the counts of the input tables. If you run Table.RowCount on Counts itself, you get 2 regardless of how many rows survived the filter.
Verify both counts against the table
Select the Source step and check that it shows one ticket per row. W01, W03, and W05 have Ready in the Status column. W02 and W04 have Hold. Select ReadyRows next and confirm that only the three Ready tickets appear. Returning to the stage count closes the check. In code, Table.SelectRows supplies the filtered table and Table.RowCount supplies a number. The count applies to the exact step you give it, so choosing a step earlier or later in a real query can change the answer.
Try changing W03 from Ready to Hold in Advanced Editor. The original count stays at 5, while After filter falls to 2. Change W03 back, then add a new input record for W06 with a Ready status. The counts should become 6 and 4. Those checks distinguish two things that can otherwise look alike when a report total changes. A change to a status can alter how many records pass the filter. A new input record increases the original count and may change the filtered count as well.
Diagnose an unexpected count
A zero after the filter is a valid result. If you expected some matches, inspect the actual Status values at Source. A vendor export might use ready, Ready followed by a space, or a longer phrase such as Ready for review. The exercise compares the field to an exact text value. Decide which variants should qualify before you normalize the input. If the meanings differ, count them separately or correct them at the source rather than allowing them all through by accident.
Duplicates are another common source of confusion. Table.RowCount counts records, so two rows that share a Ticket value each contribute one to the total. If your reporting question is how many unique tickets are present, make uniqueness an explicit step before counting. Inspect repeated ticket numbers first. A ticket might have several legitimate status updates, and collapsing those records without a rule could hide a recent change.
If both counts are unexpectedly identical, confirm that the second Table.RowCount receives ReadyRows. A copied expression that still calls Table.RowCount(Source) is syntactically valid and will report an apparently reassuring match. Set all five sample statuses to Hold and see if After filter reaches zero. That small control case is useful when the difference between the real counts is usually small or sometimes zero on purpose.
Adapt the check to a production query
The example ends with in Counts so the result is a two-row summary. If your original query must keep outputting detailed records for a report, leave its final expression intact. Build a separate diagnostic query or make a practice copy before adding a counts table. Microsoft documents that separately evaluated references can cause additional source retrieval in some workloads. Check refresh behavior before adding several independent counts to a large connected model.
The exercise uses Power BI Desktop and M syntax. In another Power Query host, or in the newer editor interface, the blank-query and Advanced Editor controls may be placed differently. Verify the selected query before pasting. For a final exercise, add a sixth row with an empty text status and then replace that empty text with Ready. Predict Before filter and After filter both times. Before filter should stay at 6, with After filter changing from 3 to 4. That makes a useful check on which step the formula is counting.
If you keep a copy of the counts for weekly review, write down the date, source export, and filter value next to each pair of totals. A result of three Ready tickets on Monday is comparable with Friday's result only if both exports cover the same kind of records. When the filter intentionally changes, run the old and new conditions against the same input once. That makes it possible to distinguish a change in the definition of Ready from a change in the underlying requests.
Sources and related reading
Microsoft Learn Table.RowCount
Microsoft Learn Table.SelectRows
Microsoft Learn #table constructor
Microsoft guidance on query references
Classify a variance direction with Number Sign in Power Query














