> ## Documentation Index
> Fetch the complete documentation index at: https://lightdash-mintlify-cccf65ca.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Querying from tables and exploring your data

Now that you've connected your dbt project to Lightdash, it's time to start exploring your data.

A **Table** is the main starting point for exploring data in Lightdash. It contains a group of related dbt models, dimensions, and metrics. You **explore Tables in the Explore view**.

## An intro to tables and the explore page

To start a new query, click on `[+] New` --> `Query from tables`, then select the table that you want to explore.

<Frame>
  <img src="https://mintcdn.com/lightdash-mintlify-cccf65ca/4GhtOnsLHg0poBCZ/images/get-started/exploring-data/using-explores/new-query-from-tables.png?fit=max&auto=format&n=4GhtOnsLHg0poBCZ&q=85&s=f957ee11c6d6539bba66b6c88d750554" alt="" width="2031" height="1253" data-path="images/get-started/exploring-data/using-explores/new-query-from-tables.png" />
</Frame>

The explore page is made up of five main areas:

1. [**Metrics and Dimensions**](/get-started/exploring-data/intro-metrics-dimensions) that are available on the table you selected
2. **Filters**, which lets you restrict the data in your query
3. **Chart**, where you'll visualize your query results
4. **Results**, the raw data returned from your database
5. **SQL**, shows the generated SQL that produced the results

<Frame>
  <img src="https://mintcdn.com/lightdash-mintlify-cccf65ca/4GhtOnsLHg0poBCZ/images/get-started/exploring-data/using-explores/explore-areas.png?fit=max&auto=format&n=4GhtOnsLHg0poBCZ&q=85&s=b67a6a6734a1e369c1ed5dcb1d8f9eb8" alt="" width="2550" height="1668" data-path="images/get-started/exploring-data/using-explores/explore-areas.png" />
</Frame>

### Select your fields

To run a query:

1. Select a metric to calculate
2. Select one or more dimensions to split the metric into groups
3. Hit **Run query** in the top right

For example, if I wanted to know the "number of orders per month split by partner", I'd select the `Order count` metric, the `Order month` dimension, and the `Partner name` dimension, to split by partner.

<Frame>
  <img src="https://mintcdn.com/lightdash-mintlify-cccf65ca/4GhtOnsLHg0poBCZ/images/get-started/exploring-data/using-explores/select-fields.png?fit=max&auto=format&n=4GhtOnsLHg0poBCZ&q=85&s=6758876fc23b8a99a48267c5b9540645" alt="" width="2540" height="1586" data-path="images/get-started/exploring-data/using-explores/select-fields.png" />
</Frame>

### Filter results

You can add filters in a few different ways:

1. Click `+ Add filter` in the **Filters** section.
2. Open the column header menu in the **Results** table, then `Filter by [field name]`.
3. Click the filter icon that appears when you hover over **Dimensions** and **Metrics**.

<Frame>
  <img src="https://mintcdn.com/lightdash-mintlify-cccf65ca/4GhtOnsLHg0poBCZ/images/get-started/exploring-data/using-explores/add-filter.png?fit=max&auto=format&n=4GhtOnsLHg0poBCZ&q=85&s=384079a909177239572a8080b0fb7f46" alt="" width="2550" height="1563" data-path="images/get-started/exploring-data/using-explores/add-filter.png" />
</Frame>

### Sort results

Click on the arrow in the table header for the field you want to sort by.

<Frame>
  <img src="https://mintcdn.com/lightdash-mintlify-cccf65ca/4GhtOnsLHg0poBCZ/images/get-started/exploring-data/using-explores/sort-results.png?fit=max&auto=format&n=4GhtOnsLHg0poBCZ&q=85&s=17d23b979fc79a76327f5b56c1e23ef6" alt="" width="1825" height="1102" data-path="images/get-started/exploring-data/using-explores/sort-results.png" />
</Frame>

If you want to sort by multiple fields, click the blue pill that displays the current sort, then choose `+ Add sort`.

<Frame>
  <img src="https://mintcdn.com/lightdash-mintlify-cccf65ca/4GhtOnsLHg0poBCZ/images/get-started/exploring-data/using-explores/sort-multiple.png?fit=max&auto=format&n=4GhtOnsLHg0poBCZ&q=85&s=7eedb1c648e47c3eee26c92b51650239" alt="" width="1820" height="1160" data-path="images/get-started/exploring-data/using-explores/sort-multiple.png" />
</Frame>

Here is the expected behavior of the sort menu:

1. When you add a sort by clicking on a column header, that sort will overwrite any previous rules.
2. After using the sort menu to sort by multiple columns, you can drag-and-drop columns to rearrange the order.
3. Remove a sort by clicking the `X` to the right.
4. Change the order of a column's sort using the toggle next to the field name in the sort menu.

#### Sorting NULL values

You can specify whether NULL values should appear first, last, or use your database's default sorting behavior.

<img src="https://mintcdn.com/lightdash-mintlify-cccf65ca/4GhtOnsLHg0poBCZ/images/get-started/exploring-data/using-explores/sort-null-values.png?fit=max&auto=format&n=4GhtOnsLHg0poBCZ&q=85&s=cffbbd82c0b513982446dad1f05241c6" alt="Sort Null Values Pn" width="1206" height="317" data-path="images/get-started/exploring-data/using-explores/sort-null-values.png" />

To configure NULL sorting:

1. Open the sort menu by clicking the blue pill that displays the current sort
2. For each sort field, use the NULL sorting control to select your preference:
   * **Nulls first** - NULL values appear at the top of the results
   * **Nulls last** - NULL values appear at the bottom of the results
   * **Default** - Uses your database's default NULL sorting behavior

The NULL sorting behavior is applied to the generated SQL query using `NULLS FIRST` or `NULLS LAST` clauses in the ORDER BY statement.

### Build a chart

Once the query runs, your data will appear in the results table. You can then open the **Chart** section and choose a chart type.

You can read more about [all the chart types and configurations here](/references/chart-types/overview).

<Frame>
  <img src="https://mintcdn.com/lightdash-mintlify-cccf65ca/4GhtOnsLHg0poBCZ/images/get-started/exploring-data/using-explores/build-chart.png?fit=max&auto=format&n=4GhtOnsLHg0poBCZ&q=85&s=8fd0e1464646b0581ab035d657c9eac0" alt="" width="2547" height="1571" data-path="images/get-started/exploring-data/using-explores/build-chart.png" />
</Frame>

### Save your chart

Saved Charts allow you to save a specific chart or table so you can share, add it to a dashboard, or revisit it again in future.

When you open a saved chart, it will always update to display the latest data in your database since it will re-run the query each time you open it.

<Frame>
  <img src="https://mintcdn.com/lightdash-mintlify-cccf65ca/4GhtOnsLHg0poBCZ/images/get-started/exploring-data/using-explores/save-your-chart.png?fit=max&auto=format&n=4GhtOnsLHg0poBCZ&q=85&s=a46ce3f0b2558327e4d85bbb9d3a559e" alt="" width="2561" height="1240" data-path="images/get-started/exploring-data/using-explores/save-your-chart.png" />
</Frame>

To save a chart, click the `Save chart` button at the top of the page, then give your chart a useful name and description. You'll have the option to save the chart to a Dashboard or a Space.

Once you save a chart, it unlocks these useful features:

* [Version history](/guides/version-history)
* [Scheduled deliveries](/guides/how-to-create-scheduled-deliveries)
* [Google Sheets syncs](/references/integrations/google-sheets)
* [Alerts](/guides/how-to-create-alerts)

#### Saving to a Dashboard

The majority of charts in Lightdash are saved directly to a dashboard. This option is better if your chart is only ever going to be used on one dashboard anyways. When you save a chart to a dashboard it doesn't clutter up your Spaces with long lists of charts that only make sense in the context of a specific dashboard.

Saving a chart to a Dashboard means it only lives within that single dashboard. If you want to reuse it you'll need to move it to a space or click `Explore from here` and create a new version of the chart.

#### Saving to a Space

Saving a chart to a Space means it can be shared individually and reused across multiple dashboards. This option is also the only way to [pin a single chart to your project home page](/references/workspace/pinning).

You'll get a nice **Saved chart view** that you can use to share with others.

<Frame>
  <img src="https://mintcdn.com/lightdash-mintlify-cccf65ca/4GhtOnsLHg0poBCZ/images/get-started/exploring-data/using-explores/saved-chart.png?fit=max&auto=format&n=4GhtOnsLHg0poBCZ&q=85&s=75f88ec45fe83b2b6901e7e948460b28" alt="" width="2558" height="1675" data-path="images/get-started/exploring-data/using-explores/saved-chart.png" />
</Frame>

### Changing the explore of an existing chart

Once a chart is saved, you can switch the explore (table) it is built on without having to recreate the chart. Open the saved chart, open the **Change explore** dialog, pick the new explore, and all field references will be remapped to it.

<Frame>
  <img src="https://mintcdn.com/lightdash-mintlify-cccf65ca/4GhtOnsLHg0poBCZ/images/get-started/exploring-data/using-explores/change-chart-explore.png?fit=max&auto=format&n=4GhtOnsLHg0poBCZ&q=85&s=cb9432fe85409717d245ed69812fdde1" alt="" width="652" height="387" data-path="images/get-started/exploring-data/using-explores/change-chart-explore.png" />
</Frame>

Tick **Also update all other charts using this explore** to remap every chart built on the current explore in one go — useful when an entire model is being replaced.

Fields that exist on the new explore with the same field IDs are kept; anything that doesn't exist on the new explore is dropped, and you'll need to re-pick the missing fields before saving.

<Tip>
  A handy use case is **migrating charts from one model to another** — for example, when you rename a dbt model or replace it with a new version. Instead of rebuilding the charts from scratch, point them at the new explore and keep the configuration that still applies.
</Tip>
