Skip to content
datastudyguides

DP-600 · 2.2.9 · Prepare data

Filter data

Filter data

Use WHERE for rows, HAVING for aggregate groups, and for window results, placing each filter at the earliest valid stage.

The core idea

T-SQL filter order in Fabric showing WHERE for rows, HAVING for aggregates, QUALIFY for window results, and correct NULL handling.

Place a filter at the earliest stage where its condition exists. WHERE handles row-level , HAVING handles aggregate results, and handles window-function output.

cannot be referenced in WHERE because they have not been calculated yet.

A comparison with is unknown, so expressions such as Region <> 'West' also exclude NULL unless you add an explicit IS NULL branch.

Key points

  • WHERE: filters individual rows before grouping
  • HAVING: filters groups after aggregates are calculated
  • : filters rows after
  • : keep or remove explicitly with IS NULL checks

Click an underlined term for a one-line explanation, or see them all in the glossary .

Exam trap

Putting a such as ROW_NUMBER in WHERE fails. Move the condition to , or compute the number in a CTE first.

Sources · 4 Microsoft Learn pages Show ▾

Checked on October 4, 2026. Report a problem

Go deeper on Microsoft Learn

Checked against Microsoft Learn on October 4, 2026. Report a problem with this card

How well do you know this?