Launch Deal · 50% off 1st month ·

2.8 — Query Data with KQL

DP-600 Domain 2 · Skill 2.8

What You Need to Know

Kusto Query Language (KQL) queries data in eventhouses and KQL databases. It reads top to bottom as a pipeline of operators joined by the pipe character. You need to be able to select, filter and aggregate with it, and read short queries.

Where you write KQL

  • A KQL queryset (a saved set of queries over one or more KQL databases), or the query pane of a KQL database.
  • Real-Time Dashboards: each tile is a KQL query.
  • Power BI: connect to a KQL database (DirectQuery or Import), or use Direct Lake on the OneLake copy.
  • KQL databases also accept a subset of T-SQL, which helps SQL users get started.

Core operators

Operator Purpose Example
where Filter rows where Timestamp > ago(1d) and Country == "SE"
project Choose or rename columns project Timestamp, DeviceId, Temp
extend Add calculated columns extend TempF = Temp * 9 / 5 + 32
summarize Aggregate (like GROUP BY) summarize Avg = avg(Temp), Max = max(Temp) by DeviceId
bin() Bucket time for aggregation summarize count() by bin(Timestamp, 1h)
top / order by Rank or sort top 10 by Max desc
join Combine tables (kind=inner, leftouter and others) join kind=leftouter (Devices) on DeviceId
distinct / count Unique values or a row count distinct DeviceId
arg_max() Latest row per key summarize arg_max(Timestamp, *) by DeviceId
render Chart the result render timechart

Reading a KQL query

SensorReadings
| where Timestamp between (ago(7d) .. now())
| where Site in ("Oslo", "Lund")
| summarize AvgTemp = avg(Temperature), Readings = count() by Site, bin(Timestamp, 1d)
| order by Site asc, Timestamp asc
| render timechart

The result is one row per site per day for the last 7 days, with the average temperature and the number of readings, drawn as a time chart.

Habits that matter

  • KQL is case-sensitive for table and column names and for ==. Use =~ for case-insensitive equality.
  • Filter early, especially on time, so less data is read.
  • has matches whole terms (it uses the index); contains matches substrings (slower).
  • String literals use double or single quotes; datetime literals look like datetime(2026-11-01); time spans look like 1h, 7d, 30m.

Key Concept: A KQL query is source table, then operators separated by pipes. where filters, project selects, extend adds columns, summarize ... by bin() aggregates over time, and arg_max keeps the latest row per key.

Exam Traps

  • Using project to filter rows (that's where)
  • Expecting summarize count() by Timestamp to bucket by hour (you need bin(Timestamp, 1h))
  • Using == with a different case and expecting a match
  • Putting where after summarize when it should filter the raw rows first

Check your understanding

Practice Scenario

🔒 This practice scenario is part of Skillmarked Pro

The lessons stay free. Pro unlocks the other 17 DP-600 practice scenarios and the 50-question timed mock exam, plus everything for every other exam.

See plans

Launch Deal: first month €9.95, then €19.90/month. Enter code LAUNCH50 at checkout. Ends 1 December.

Cancel anytime. Or €199 a year, which saves 17%.

Not sure yet? Try 10 free mock exam questions.

Already Pro? Log in.

Sources