Getting started
Start with a question about your store and write it as a query. Each example below adds one clause to the one before it, building from a simple total to a full chart.What is my stock worth?
What is my stock worth?
FROM picks the inventory dataset and SHOW picks the inventory_value metric. With no grouping, the result is a single total.Which vendors hold the most value?
Which vendors hold the most value?
Add
GROUP BY vendor to break the total down into one row per vendor.What sold best last month?
What sold best last month?
Switch to the sales dataset, show revenue and units, group by product, and set the window with
DURING. ORDER BY and LIMIT keep the top rows.How does that compare to the month before?
How does that compare to the month before?
COMPARE TO previous_period runs the query again over the prior window and adds the change to each row.Show it as a chart
Show it as a chart
VISUALIZE turns the table into a chart. Here the top sellers become a bar chart, each bar carrying its change against the month before.Running StockfulQL
You write a query once and meet the same query in a few places. The query is identical everywhere; only what surrounds it changes.Parts of a query
- Syntax is the clause set:
FROMandSHOW,WHERE,GROUP BY, date ranges, comparison,TIMESERIES, sorting, limits and charts. - Datasets are the data you can query, grouped by area. Each dataset’s page lists the metrics, dimensions and filters it exposes.

