Create a dashboard base query

Base queries are reusable query snippets that can be used as building blocks for all dashboard query components such as parameters, tiles, and other base queries. A single base query is managed in the context of a specific dashboard. Each dashboard can have one or more base queries. Base queries make query maintenance in dashboards easier, as queries can be managed in a central location.

To interactively explore sample dashboards, see Quickstart: Visualize sample data dashboards.

Note

Base query creation and management is available in Editing mode to dashboard editors.

Important

When using base queries, you can't refer to a different data source than is already used in a particular tile or parameter.

Prerequisites

  • A Microsoft account or a Microsoft Entra user identity. An Azure subscription isn't required.
  • Dashboard editing permissions on an Azure Data Explorer dashboard

Create a base query

  1. Toggle the dashboard mode from Viewing to Editing.

  2. At the top of the dashboard, select Base queries.

    Screenshot of dashboard menu in Azure Data Explorer with the base queries option highlighted by a red box.

    The base query pane opens to the right.

  3. Select + New base query.

    Screenshot of new base query in Azure Data Explorer dashboards.

  4. Enter a Variable name to be used as reference to this base query.

    Note

    We suggest starting each base query name with an underscore (_) for easy use later, and so as not to conflict with Kusto-defined names. For more information, see naming your entities

    Screenshot of create base query in Azure Data Explorer dashboards.

  5. Select a data Source from the dropdown.

  6. Enter the KQL query that will be used as the base query. This query can optionally contain other base queries.

  7. Select Done.

Manage base queries

Within the base query pane, you can view the list of existing base queries. In each base query card, select the pencil widget to edit the base query, or select the More [...] menu to duplicate, delete, or move the base query. Base query order can also be changed by dragging and dropping the card.

The following indicators can be viewed in the base queries card:

  • Base query variable name
  • Number of tiles in which the base query was used
  • Number of parameters in which the base query was used
  • Number of base queries in which the base query was used

Use a base query

Base queries can be used in dashboard tiles, parameters, and other base queries. Use the base query by entering ['variablename'] in the query editor.

Screenshot of using a base query in Azure Data Explorer dashboards.