Query Builder guide
Query Builder lets you ask your own questions of the published business model: pick fields, filter, group, calculate, chart, export, save, share and schedule, without writing SQL.
Who: Explorers, Builders, Modelers and Admins, in workspaces where Business Model is turned on. Open it from the Portal: Build → Query Builder (it opens in a new tab). Viewers can't build queries, but they can run saved queries in the Portal.
Query Builder reads the views and cubes your Modelers published in Business Model. It doesn't create dashboards (that's Dashboard builder). The only model change it makes is adding your own file to a view (Admins and Modelers).
Start a query
A new query starts empty, named "Untitled query". Rename it in the box at the top. Use Query from to pick the view to work from.
Ask in plain English
Type a question in the box at the top, for example top 10 stores by net sales last quarter, and select Build query. The AI picks the fields, filters, sort and top N for you, using only fields that exist in the model. A Built from your question line shows what it chose; Undo puts the query back. You can keep editing by hand. (Available when AI assist is on for the workspace.)
Build it by hand
| Control | What it does |
|---|---|
| Field list (left) | Views and cubes from Business Model, in their folders. Click or drag a field into Columns. |
| Columns | Your query's fields. Drag to reorder; click one for its menu. |
| Filters | Values, text matches or comparisons. With two or more, choose Match all or Match any. Group brackets filters into their own all/any group. Blanks: as usual, also include, or leave out. |
| Date chip | A date range for the first date field (presets or custom). |
| List / Crosstab / Chart | How results are shown. Chart types: Automatic, Line, Area, Bar, Column, Pie, plus With table. |
| Subtotals / Totals | A subtotal per group and a grand total row. |
| Preview / All rows | Preview shows the first 50 rows; All rows shows up to 10,000. |
| Auto-run | Re-runs as you change the query. Turn it off and use Run for big queries. |
| View as | Run as one customer (their rows only), or all customers with staff access. |
| Show query | The query and the SQL that ran. |
Column menu
Click a column heading for:
| Item | What it does |
|---|---|
| Sort | Ascending or descending. |
| Group by… / Ungroup | Group rows by this column with a subtotal per value. Groups nest. Show only … totals collapses to summary lines. |
| Define custom groups… | A new column that buckets values into named lists or number ranges. |
| Text calculation… / Date calculation… | A new column from this one: join columns, first or last characters, upper or lower case, year, quarter, month name, day of week, days since. |
| Show as | Value, % of total, % of group, Rank, Running total (measures). |
| In total rows | What totals show for this column: automatic, total, average, min, max, count. |
| Conditional styles… | Color cells by ranges or values, with a legend. |
| Rename heading… | Changes the heading in this query only. |
Calculate in the toolbar adds arithmetic between measures, or with a number.
Whether a measure is a sum or an average is set in Business Model. If you need a different aggregation, ask a Modeler to add that measure.
Drill and quick filters
Click a value in the List:
- Dates: Drill down to a finer period, Drill up, or Only this period.
- Other fields: Drill down / up along the field's folder (for example Division → Region → District → Store), Filter to this value or Exclude this value.
Prompts
In a filter, turn on Ask when the query runs to make it a prompt: a question, required or optional, one or many values. The date range can prompt too. Anyone opening the saved query answers the prompts first. Copy link shares the query with the answers filled in.
Analyze your own file (CSV or Excel)
Under the field list, Your files lets you upload a .csv or .xlsx file and query it on its own: list, crosstab, chart, filters, totals, calculations, export and schedules all work.
- The file is stand-alone. It doesn't join the business model, and a query uses either a file or a model view, never both.
- The field list shows exactly the file's columns, nothing added. To total or count something, use the menu beside a field to make it a measure: Sum, Average, Minimum or Maximum for number columns, Count or Count distinct for any column. Pick Column to switch it back. Date columns can be grouped by day, week, month, quarter or year. Whole-number date keys like 20231001 in a column named like a date are read as dates, and a Total row at the bottom of the file is skipped.
- Add to a view uses the same setup: measure columns become measures in the view, everything else becomes fields.
- Up to 10 MB and 100,000 rows per file. For bigger or shared data, add it in Connections and model it in Business Model.
- Only you can see your files. Teammates never see them in their file list or in Query from. To share results, save a query and share it (or put it in the Portal): people can open that query, but not browse or pick your file.
- Deleting a file stops every saved query that uses it, including ones you shared.
- View as doesn't apply to files, because they have no tenants.
- Add to a view (Admins and Modelers, the ⇪ button on a file): joins the file to a published view without leaving Query Builder. Pick the view, the field in the view to match on (for example Region or Customer ID), the matching column in your file, and a customer column (or None for data every customer shares, like targets). Click Add and publish: the file's columns are added to the view and published, and Query Builder opens the view with them in the field list. Charts and dashboards on that view can use them too. Works for views on PostgreSQL, Redshift or MySQL connections, up to about 500 KB of data. Adding the same file again replaces it. Your file in Query Builder stays private and unchanged.
Save and share
- Save keeps the query private, or select Share with workspace so others can open it.
- A new saved query also appears in your Portal My content. Move it to a Team content folder, or use Share…, to share it in the Portal.
- Only you can change or delete queries you created.
- Saved queries never keep a View as customer.
Export
Export to Excel (.xlsx, with an About sheet), Save as PDF…, CSV, or Copy as table.
Schedule
Schedule… emails a saved query as Excel or CSV daily, on weekdays, weekly or monthly, at a time and time zone you choose.
- Recipients must be members of the workspace.
- Send now sends it right away; you can turn a schedule off or delete it.
- Schedules send the last saved version. A schedule stops if its creator leaves the workspace, or a shared query stops being shared.
- If email isn't set up for your workspace, the dialog says so.
When something's off
| You see | What to do |
|---|---|
| "Query Builder isn't available" | Your role is Viewer, or Business Model is off for this workspace. |
| A field you need is missing | It isn't in the published model yet. Ask a Modeler to add it in Business Model and publish. |
| The numbers look aggregated the wrong way | The measure's aggregation is set in Business Model; ask for an extra measure. |
| A slow or huge result | Turn off Auto-run, add filters, or stay on Preview until the query is right. |
Related
- Portal guide: opening and organizing dashboards and queries.
- Business Model guide: how the fields you query are defined (Modelers and Admins).