How to Write ShopifyQL Reports (2026 Guide)

ShopifyQL query editor showing a sales report with chart visualization on a clean dashboard interface

Shopify gives every merchant a default analytics dashboard. Most merchants never look past it. The problem isn't that the default reports are bad — it's that they answer generic questions, not yours. ShopifyQL reports let you ask specific questions like "Which products have declining weekend sales compared to three months ago?" instead of just "How much did I sell last month?"

ShopifyQL is Shopify's own query language for custom reports. It's been available inside the admin for a while, but most store owners skip it because it looks like code. It's not. If you can write a spreadsheet formula, you can write a ShopifyQL query. And as of May 2026, Sidekick can write these queries for you — just describe what you want in plain English.

Without custom reports, you're making inventory, marketing, and pricing decisions on surface-level numbers. You're restocking products that look like top sellers but actually have shrinking margins. You're running promotions when traffic is already high instead of when it dips. The default dashboard won't tell you any of this. ShopifyQL will.

What Is ShopifyQL?

ShopifyQL (Shopify Query Language) is Shopify's built-in query language for pulling custom reports from your store data. It works like a simplified version of SQL, purpose-built for commerce. No joins to write. No database schemas to memorize. Shopify handles the data architecture — you just tell it what you want to see.

Every ShopifyQL query needs just two keywords to work: FROM and SHOW. That's it. FROM tells Shopify which dataset to pull from. SHOW tells it which columns you want. Everything else — filtering, grouping, sorting, date ranges — is optional.

The simplest possible query looks like this:

FROM sales
SHOW total_sales

That returns your total sales across all time. Not particularly useful on its own, but it proves the point: ShopifyQL isn't intimidating once you see the structure.

The 6 Keywords You Need to Know

Every ShopifyQL query is built from a small set of keywords. Here's what each one does:

  1. FROM — picks the dataset. Your options include sales, orders, products, customers, and sessions (among others).
  2. SHOW — selects the columns you want returned. Use AS to rename them for readability (e.g., SHOW gross_sales AS revenue).
  3. WHERE — filters your data. Only return rows that match a condition (e.g., WHERE product_title == 'Blue Widget').
  4. GROUP BY — aggregates results by a dimension. Group sales by product, by channel, by country — whatever you need.
  5. SINCE / UNTIL — sets the date range. Use relative dates like SINCE -30d UNTIL today or absolute dates like SINCE '2026-01-01'.
  6. ORDER BY — sorts the output. Add DESC for highest-first or ASC for lowest-first.

Two bonus keywords worth knowing: LIMIT caps the number of rows returned (useful for "top 10" reports), and TIMESERIES breaks data into time buckets for trend visualization.

5 ShopifyQL Report Templates You Can Copy Today

Copy these into the ShopifyQL editor in your Shopify admin (go to Analytics → Reports → Create custom report). Modify the date ranges and filters to match your store.

1. Top 10 Products by Revenue (Last 90 Days)

FROM sales
SHOW gross_sales AS revenue
GROUP BY product_title
SINCE -90d UNTIL today
ORDER BY revenue DESC
LIMIT 10

This tells you which products actually drive your top line. Compare it quarterly to spot rising and falling performers before the default dashboard flags anything.

2. Daily Sales Trend (Last 30 Days)

FROM sales
SHOW total_sales
TIMESERIES day
SINCE -30d UNTIL today

ShopifyQL can render this as a line chart directly in the editor. Look for patterns — dips on specific weekdays, spikes after email campaigns, or slow declines that suggest a traffic problem.

3. Sales by Marketing Channel

FROM sales
SHOW total_sales
GROUP BY referring_channel
SINCE -30d UNTIL today
ORDER BY total_sales DESC

This shows you where your money actually comes from. If organic search drives twice the revenue of paid social, that changes where you invest your next dollar. (If you suspect your channel data is off, read our guide on the attribution gap that burns ad budgets.)

4. Orders by Country (Last Quarter)

FROM orders
SHOW count() AS order_count
GROUP BY billing_country
SINCE -90d UNTIL today
ORDER BY order_count DESC
LIMIT 15

Useful for merchants selling internationally. If a country is growing fast, it might justify localized shipping rates, currency settings, or translated content.

5. Product Sales With Discounts Applied

FROM sales
SHOW product_title, gross_sales, discounts, net_sales
WHERE discounts > 0
GROUP BY product_title
SINCE -30d UNTIL today
ORDER BY discounts DESC
LIMIT 20

This shows which products get sold with discounts most often — and how much those discounts actually cost you. If a product consistently sells at a discount, your regular price might just be wrong.

Use Sidekick to Skip the Syntax Entirely

As of May 2026, Shopify's Sidekick AI can generate ShopifyQL queries from plain English. Open Sidekick in your admin and describe the report you want. "Show me fulfillment times by carrier" or "What were my net payments for each payment method last quarter?" — Sidekick translates your question into a working query.

What makes this genuinely useful (not just a gimmick):

  • It explains each query. Sidekick doesn't just spit out code — it tells you what each part measures in plain language. You learn the syntax by seeing real examples.
  • You can refine with follow-ups. Sidekick remembers conversation context. Ask "now break that down by month" or "filter out returns" and it adjusts the query.
  • It handles visualization. Sidekick can render results as bar, line, or donut charts and export to CSV, JSONL, XML, or Parquet.

The practical workflow: start with Sidekick to generate your first version, then open the ShopifyQL editor to tweak it. Over time, you'll write queries directly because you've absorbed the syntax from Sidekick's examples. (New to Sidekick? Read our full Sidekick guide.)

Why Isn't My ShopifyQL Query Working?

ShopifyQL is forgiving, but there are a few things that trip up new users:

Wrong dataset for the question. If you want to know how many orders you got, query orders, not sales. The sales dataset is revenue-focused; orders is count-focused. They overlap, but they're structured differently.

Forgetting GROUP BY when using aggregates. If you SHOW count() alongside product_title, you need GROUP BY product_title. Otherwise ShopifyQL doesn't know how to group the counts.

Date range too broad. Querying SINCE -1y on a high-volume store can take a while. Start with 30 or 90 days while you're experimenting, then widen the range once the query works.

Comparing apples to oranges. Gross sales, net sales, and total sales mean different things in ShopifyQL. Gross is before discounts and returns. Net is after. Total includes shipping and taxes. Pick the one that matches what you're actually trying to measure.

Turn Reports Into Recurring Decisions

A report you run once is a curiosity. A report you run every Monday is a management tool. Here's how to make ShopifyQL reports part of your actual workflow:

Save your queries as custom reports. Every query you write in the ShopifyQL editor can be saved. It also creates a metric card you can pin to your dashboard. Build a dashboard with the 4-5 metrics that actually drive your decisions — not the 20 default cards Shopify gives everyone.

Set a weekly review cadence. Pick one morning per week. Open your custom dashboard. Look for anomalies: a product dropping, a channel spiking, a country growing. Ten minutes of review prevents a month of bad assumptions.

Build reports for specific decisions. Don't build reports to "track everything." Build them to answer a specific question you face regularly. "Should I reorder this SKU?" → build a report that shows units sold per week for the last 12 weeks. "Is this discount code actually profitable?" → build a report that isolates sales with that code and shows the net margin.

The merchants who get the most from ShopifyQL reports aren't the ones writing the most complex queries. They're the ones who build 3-5 simple reports tied to decisions they make every week — and actually check them.

Start with one query from the templates above. Save it. Check it next Monday. If it changes even one decision, you'll build the second report the same day.