# How do I filter and aggregate Fabric relational data without changing its grain accidentally?

Exam: DP-600 — Implementing Analytics Solutions Using Microsoft Fabric
Knowledge domain: Prepare data (45–50%)
Updated: 2026-11-19T05:35:26.399828+00:00
HTML: https://learningpathx.com/faq/DP-600/dp600-sql-filter-group-query.html

## Also asked as

- What is a safe pattern for a grouped SQL query in a Fabric Warehouse?
- How should I validate a SQL aggregation over Fabric analytical tables?

Start from a known input grain, filter the intended population, then group only by the required output dimensions. Validate join cardinality before adding dimension tables; a correct GROUP BY cannot repair duplicated input rows.

For an illustrative Warehouse table dbo.Sales with one row per sale line, a typed SaleDate, a Region column, and same-currency Revenue, this read-only query returns annual revenue by region:

```sql
SELECT Region, SUM(Revenue) AS Revenue
FROM dbo.Sales
WHERE SaleDate >= '2026-01-01'
  AND SaleDate < '2027-01-01'
GROUP BY Region;
```

Replace the table and columns with your actual contract. Reconcile the filtered row count and revenue total against a trusted source. If you add dimension joins, check key uniqueness and unmatched records, and confirm that totals remain consistent at equivalent scope. Define null and currency handling rather than letting an example decide those business rules.

SQL fits reusable relational results and quality checks. A report-aware calculation that must respond to semantic relationships and user selections can belong in a Power BI measure instead.

[Query Fabric Warehouse and SQL analytics endpoints](https://learn.microsoft.com/en-us/fabric/data-warehouse/query-warehouse). [Fact grain and aggregation](https://learn.microsoft.com/en-us/fabric/data-warehouse/dimensional-modeling-fact-tables).

Source: [DP-600: Querying Microsoft Fabric with Visual Query Editor, SQL, KQL, and DAX](https://learningpathx.com/news/dp-600-querying-microsoft-fabric-with-visual-query-editor-sql-kql-and-dax.html)
