> For the complete documentation index, see [llms.txt](https://docs.fabricplan.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fabricplan.com/powertable-sheets/how-tos/configure-column-properties/lookup-and-relation.md).

# Lookup and relation

This article explains how to configure columns that use the **Single Select** input type.

Single-select columns allow users to choose a value from a predefined list of options. You can configure the available options in one of the following ways:

* [**Manual**](#manual) - Define the dropdown options manually.
* [**Distinct Values**](#distinct-values) - Generate dropdown options from existing column values.
* [**Lookup**](#lookup) - Retrieve dropdown values from another table, typically to establish foreign key relationships.

Using predefined options helps maintain data consistency, simplify data entry, and standardize values across records.

The following sections describe how to configure each option source.

### Manual

Use the **Manual** option to define dropdown values and labels directly.

To configure dropdown values manually:

1. In the column setup window, select the pencil icon next to the required column.
2. Set **Input Type** to **Single Select**.
3. Select **Manual** as the **Values Type**.<br>

   <figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FpJzpvBCF22wjZT0wRwN8%2Fimage.png?alt=media&amp;token=a5399178-5d49-4127-9b33-958cd799101a" alt=""><figcaption></figcaption></figure>
4. Enter the required options and labels. Then, configure the background color for each label.
5. Select **Save**.<br>

   <figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FlZ5UmyQK3mqlyGZETDWs%2Fimage.png?alt=media&amp;token=7c3efba0-14f3-4e05-ad86-44bd22ffd876" alt=""><figcaption></figcaption></figure>

Use **Add** to create additional options or the delete icon to remove an existing option.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FbNSW13f8F5etOkW5aAEI%2Fimage.png?alt=media&amp;token=b4ff3700-346f-4de3-8d6a-9a3b2596cc71" alt=""><figcaption></figcaption></figure>

After the configuration is saved, you can select values from the configured dropdown list when editing records.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FJ0JUuC6pl0SWFZ9W0nJl%2Fimage.png?alt=media&amp;token=29322c28-bc52-4a84-802f-a04e9a28d7f3" alt=""><figcaption></figcaption></figure>

### Distinct Values

Use the **Distinct Values** option to generate dropdown values from the existing values in the selected column.

To configure dropdown values from existing data:

1. Select the pencil icon next to the required column.
2. Set **Input Type** to **Single Select**.
3. Select **Distinct Values** for the **Values Type**.
4. Select **Save**.<br>

   <figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FMXo7KyA4Ql5HeG9XbhO3%2Fimage.png?alt=media&amp;token=6dd1fd5d-e20e-44a9-b45b-25c7725aff67" alt=""><figcaption></figcaption></figure>

PowerTable creates a unique list of values from the selected column and uses them as dropdown options. You can then select values from the generated dropdown list.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2F3T7B4xSlmWJ2psSiZeIM%2Fimage.png?alt=media&amp;token=19911cd9-0579-439e-ba4d-3047b599471d" alt=""><figcaption></figcaption></figure>

### Lookup

Use the **Lookup** option to retrieve dropdown values from another table.

This option is commonly used to display user-friendly values for foreign key fields while storing the corresponding key values in the database.

To configure a lookup table:

1. Select the pencil icon next to the required column.
2. Set **Input Type** to **Single Select**.
3. Select **Lookup** as the **Values Type**.
4. In **Lookup Schema**, select the schema that contains the lookup table.
5. In **Lookup Table**, select the table that contains the lookup values.
6. Under **Lookup Key Column**, select the current table column that contains the key values.
7. Under **Lookup Display Column**, select the lookup table column that contains the values to display.
8. Select **Save**.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FrxinFePo9fJgL5FXad6x%2Fimage.png?alt=media&amp;token=05ca89b6-4a48-4e52-80f8-b82940475c11" alt=""><figcaption></figcaption></figure>

Optionally, select **Add Hierarchy** to configure additional levels in the lookup hierarchy. To remove a hierarchy level, select the **Delete** icon next to it.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FlterWk1LD9cZj9XZHZyM%2Fimage.png?alt=media&amp;token=d5402159-1827-47e0-b154-55cc36323093" alt=""><figcaption></figcaption></figure>

After a lookup is configured, the key values in the current table are replaced with the corresponding display values from the lookup table.

For example, consider a *Products* table that contains a *ProductSubcategoryKey* column with key values.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FLSIHEPBnjxp1y04pSha6%2Fimage.png?alt=media&amp;token=0f52563b-a8ac-4cb8-933a-20a728a59b6c" alt=""><figcaption></figcaption></figure>

The *Subcategory* table serves as the lookup table and contains the *ProductSubcategoryKey* column along with the corresponding *SubcategoryName* values.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FEcPuQzAtnUTDx6y5NsTU%2Fimage.png?alt=media&amp;token=aa9cd866-d1be-4adc-accd-e1d989e58f8c" alt=""><figcaption></figcaption></figure>

When the lookup is configured, the key values in the *ProductSubcategoryKey* column are replaced with the corresponding label values from the *SubcategoryName* column. This makes the data more readable and easier to understand.

When inserting or editing records, users can select values from the lookup-based dropdown list.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FA0blnjYv9Et3UrXW2xdS%2Fimage.png?alt=media&amp;token=982a5b4a-b176-4da2-a675-f367a2d2edf3" alt=""><figcaption></figcaption></figure>

#### Filter based on another column

Use the **Filter based on another column** option to further restrict the lookup values displayed in the dropdown list.

You can configure one or more matching column pairs between the current table and the lookup table. When a filter is applied, only lookup values that satisfy all configured matching conditions are displayed.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2F1XR8IGgB7N1kJboF7rlG%2Fimage.png?alt=media&amp;token=301e521f-9cc3-4cfe-b221-60cba4a6b101" alt=""><figcaption></figcaption></figure>

### FAQ

#### What does the **Values Type** set to **Distinct Values** do for a **Single Select** column?

The **Distinct Values** option builds the dropdown list from the unique values that already exist in the column instead of using a predefined list.

PowerTable reads all unique values in the column and displays them as the available options in the **Single Select** dropdown.

#### If **Distinct Values** builds the list from existing data, how can users add a new value?

Use the **Allow Adding New Options** checkbox in the **Constraints** section of the **Edit Column** dialog.

When this option is enabled, users can search for a value in the dropdown. If the value doesn't already exist, PowerTable displays an option to add it to the list.

#### Does a lookup column display only the values that are present in the current table?

No. A lookup column displays the complete set of distinct values from the lookup table, not just the values that are present in the current table or the column where the lookup is configured.

#### How do I add a new value to a lookup column?

To add a new value to a lookup column, first insert the value into the table that contains the lookup values. The new value then becomes available in the lookup column.

#### In a lookup column, what is stored in the row - the key or the display value?

A lookup column stores the **key** for the displayed value.

When you configure a lookup column, PowerTable treats the values in the column as business keys and displays the corresponding values from the same table or a different table.

#### Can I configure a lookup column by using the same table?

Yes. You can configure a lookup column that references the same table.

For example, an **Employee** table might contain an **Employee ID**, **Employee Name**, and **Manager ID**. You can configure the **Manager** column as a lookup that references the **Employee** table to display the manager's name.

#### What does **Add Hierarchy** do in the lookup configuration?

The **Add Hierarchy** option displays a drill-down hierarchy in the lookup dropdown, making it easier to organize and navigate lookup values.

You can configure the hierarchy by using multiple tables that are related through common columns.

#### What does **Filter based on another column** do in the lookup configuration?

The **Filter based on another column** option filters the values in a lookup column based on columns that are common between the source and lookup tables.

This option displays a filtered list of values in the lookup dropdown based on the corresponding value of another column in the same row.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fabricplan.com/powertable-sheets/how-tos/configure-column-properties/lookup-and-relation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
