Choose a report filter by when its condition should apply. Selecting a set of dimension values and retaining aggregate rows above a metric threshold are different operations. A request can be syntactically accepted while answering a different question from the one in the brief.
Start with a tiny source model and write the expected aggregate result before building the actual request. That gives a reviewer something concrete to challenge. A screenshot with a few plausible totals cannot establish the intended population or filtering phase.
Read The Two Field Contracts
Google's runReport reference describes dimensionFilter as the way to request particular dimension values and says metrics cannot be used there. It describes metricFilter as applied after the report's rows are aggregated, similar to a SQL HAVING clause, and says dimensions cannot be used in that filter.
Do not infer that a filter labeled eventCount selects raw individual events whose count exceeds a threshold. The threshold applies to the aggregated rows under the selected grouping. Changing the dimensions can change those rows and therefore which ones qualify.
The data-quality review covers another concern: limits and identity context affecting returned reports. Correct filter placement does not remove those limits or authorize recovery of hidden information.
Freeze A Fictional Content Dataset
Use six invented records already summarized by guide and resource kind. Counts refer to synthetic recorded events, not visitors, sessions or customers. The example models aggregation arithmetic; it is not a GA4 export or a claim that runReport receives these records directly.
| Guide | Resource kind | Event count |
|---|---|---|
| A | worksheet | 3 |
| A | guide | 4 |
| B | worksheet | 6 |
| B | guide | 1 |
| C | worksheet | 2 |
| C | guide | 8 |
The full dataset contains 24 events. Worksheet rows sum to 11 and guide-kind rows to 13. Define the actual question as “Which guides have at least 5 worksheet events?” The intended result is B with 6, because the worksheet population is selected before the guide-level threshold is evaluated.
Compare Three Complete Query Interpretations
| Interpretation | Population and grouping | Threshold result | Event total represented |
|---|---|---|---|
| Intended worksheet question | Keep worksheet kind, group by guide | A3 fails;B6 passes;C2 fails | B6 only |
| All-kind question | No kind exclusion, group by guide | A7,B7,C10 all pass 5 | 24 |
| Whole-library threshold | Keep worksheet, no guide breakdown | Total 11 passes 5 | 11, with no answer about individual guides |
All three calculations can be internally correct. Only the first answers the stated question. Renaming the second result worksheet performance after it is returned does not repair the missing population filter.
The same metric threshold also behaves differently when an extra dimension splits a guide into more rows. Freeze the grouping before interpreting which entities pass. A changed row grain is a changed question, not merely a more detailed display.
Execute The Arithmetic Counterexample
This harmless Python models the order of the declared operations. It does not call the API or emulate its processing, privacy or estimation behavior.
from collections import defaultdict
rows = [("A", "worksheet", 3), ("A", "guide", 4),
("B", "worksheet", 6), ("B", "guide", 1),
("C", "worksheet", 2), ("C", "guide", 8)]
def aggregate(kind=None):
totals = defaultdict(int)
for guide, resource_kind, count in rows:
if kind is None or resource_kind == kind:
totals[guide] += count
return dict(totals)
def retained(totals):
return {key: count for key, count in totals.items() if count >= 5}
assert sum(count for guide, kind, count in rows) == 24
assert aggregate("worksheet") == {"A": 3, "B": 6, "C": 2}
assert retained(aggregate("worksheet")) == {"B": 6}
assert retained(aggregate()) == {"A": 7, "B": 7, "C": 10}
assert sum(aggregate("worksheet").values()) == 11The local function separates selection from aggregation and retention. A real Data API request must use actual supported dimension and metric names. A custom resource-kind dimension also needs the appropriate existing collection and registration; this example does not invent that field in a property or authorize adding it.
Translate The Question Into An Approved Request
Write the dimension selection in ordinary language first: the approved resource-kind value must be worksheet. Then specify the requested guide identifier and event-count metric. Finally define the postaggregation threshold of at least 5 for the resulting guide rows.
Map those concepts to the actual report schema with its owner. Check supported fields and compatibility. Do not paste a fictional resource_kind name into a production request and assume an empty response means no worksheets were used.
Preserve exact comparison operators and casing. At least 5 differs from greater than 5, and an exact worksheet value differs from a broad substring. A small request change can move a boundary case without any real change in resource activity.
Keep Missing Values And Exclusions Visible
If the resource kind is unavailable, do not classify it as worksheet simply because the page looks like a worksheet landing page. Preserve the source's actual dimension value and the report's permitted limits. A proposed normalization rule needs its own approved mapping.
Save how many source-model events are excluded by the population rule in the local test: thirteen guide-kind events are outside the intended worksheet question. That exclusion is deliberate; it is not tracking loss. Do not describe the final six events as the whole library's activity.
The measurement-gap method helps keep those states separate. The worked-number review checks the threshold arithmetic and denominators.
Freeze Definitions Across Comparisons
Record the request's dimensions, metric, both filter expressions, dates, identity context and retrieval time. If a reporting change adds resource kind to the visible grouping, recompute the expected row population before continuing the same trend line.
Use the release ledger to make that change inspectable. A threshold can make an entity appear or disappear abruptly even when its underlying count changes only slightly, so do not infer a new marketing cause from inclusion alone.
Approve the report when the selected population, aggregation grain and threshold match the reader decision, and the worked counterexample gives the intended result. Correct filter placement makes the analysis reproducible; it does not establish complete collection or prove that a resource caused a business outcome.
