Data and Analytics

Create a query

Write, parameterize, preview, and save a SQL query.

Available on Enterprise to Organization Admins and Collaborators.

Note:

You can base a new query on an existing one: open a query and select Duplicate (top right), then adjust the copy.

  1. Select Queries in the navigation menu, then select New. The query builder opens.
  2. Enter a Query name and Query description.
  3. Write your query in the SQL editor.

    Use Format to auto-format and Copy to copy. Use the Database panel to find data: type in Search by table or column name, or select Show more beside a source group (VAT Filing, SAF-T, Compliance Network, Intelligence, or Report Semantic Models) to browse its tables and columns.

  4. Define parameters so the query can be reused with different values. Type a colon and a name where you want a runtime value, for example, :StartDate. The builder auto-detects the token and opens a configuration popup.

    Assign each parameter a type, such as String, Number and decimal, or Date, and optionally a description, then add it. The token stays highlighted until you configure it.

    Use Bulk setup to configure all unconfigured parameters at once. A parameter that's still referenced in the SQL can't be removed.

    The parameters you define here become the values a user supplies when running a report built from this query.

  5. Select Run Preview to test. Results appear in the Query Preview grid below. If any parameter is missing a value, a pop-up prompts you to supply values first.
  6. Select Save. The query appears in the Queries list and can be used to build reports.
Important:

When saving, give each output column an alias that differs from the raw source column name (for example, SELECT COUNTRY AS "Country"). A query can preview successfully but still fail to save with the message Semantic model must use different alias if an output column reuses a source column name. See Query and reconciliation reference.

The next step is to use this saved query to build a custom report template, then run it. See Create a report template.