> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lightdash.com/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/umevcp0IVAtPUHCh/images/get-started/exploring-data/using-explores/new-query-from-tables.png?fit=max&auto=format&n=umevcp0IVAtPUHCh&q=85&s=88c9ba4ffd05ec9ced52e91ba6b87e17" 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/umevcp0IVAtPUHCh/images/get-started/exploring-data/using-explores/explore-areas.png?fit=max&auto=format&n=umevcp0IVAtPUHCh&q=85&s=81f253452b0533088ae655b485a994d8" 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/umevcp0IVAtPUHCh/images/get-started/exploring-data/using-explores/select-fields.png?fit=max&auto=format&n=umevcp0IVAtPUHCh&q=85&s=a6778e00ff16819d16877c57193ec10c" 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/umevcp0IVAtPUHCh/images/get-started/exploring-data/using-explores/add-filter.png?fit=max&auto=format&n=umevcp0IVAtPUHCh&q=85&s=204336b81f5652a8b86c6b79b423e1c2" 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/umevcp0IVAtPUHCh/images/get-started/exploring-data/using-explores/sort-results.png?fit=max&auto=format&n=umevcp0IVAtPUHCh&q=85&s=1f35342fd6fb6599edc9638c14ba001d" 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/umevcp0IVAtPUHCh/images/get-started/exploring-data/using-explores/sort-multiple.png?fit=max&auto=format&n=umevcp0IVAtPUHCh&q=85&s=b1540bd7a83a72025b7192914fa6675d" 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/umevcp0IVAtPUHCh/images/get-started/exploring-data/using-explores/sort-null-values.png?fit=max&auto=format&n=umevcp0IVAtPUHCh&q=85&s=d55063a6c7a09aeac058a71b0eef5f3b" 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/umevcp0IVAtPUHCh/images/get-started/exploring-data/using-explores/build-chart.png?fit=max&auto=format&n=umevcp0IVAtPUHCh&q=85&s=3f02526e3ad21cc79471709e7a09d082" 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/sm91nyF0lcgvVZbj/images/get-started/exploring-data/using-explores/save-your-chart.png?fit=max&auto=format&n=sm91nyF0lcgvVZbj&q=85&s=933c1ec98907b3f9cc6c85fd0adec2e1" 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/umevcp0IVAtPUHCh/images/get-started/exploring-data/using-explores/saved-chart.png?fit=max&auto=format&n=umevcp0IVAtPUHCh&q=85&s=ecd0f64174e2728091ec759c3db320de" 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/y7O6BAinYYWzLF_P/images/get-started/exploring-data/using-explores/change-chart-explore.png?fit=max&auto=format&n=y7O6BAinYYWzLF_P&q=85&s=14bf42dd6e167402f48e9a1fd431505e" 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>
