> For the complete documentation index, see [llms.txt](https://gchandra.gitbook.io/data-warehousing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gchandra.gitbook.io/data-warehousing/data-warehousing-concepts/types-of-dimensions/junk-dimension.md).

# Junk Dimension

**Cardinality: Number of Unique Values.**

A junk dimension is a dimension table created by grouping **low cardinality** and **unrelated attributes**.&#x20;

The idea behind a junk dimension is to reduce the number of dimension tables in a data warehouse and simplify queries.&#x20;

An example of a junk dimension could be a table that includes binary flags such as **"is\_promotion", "is\_return", and "is\_discount".**

Possible Values for  is\_promotion as Y or N same for is\_return and is\_discount.

**Example:**

fact\_sale table

```
Date
Product 
Store
OrderNumber

PaymentMode
StoreType
CustomerSupport

Quantity
UnitPrice
```

Possible values for these columns

**PaymentMode** - Cash/Credit/Check

**StoreType** - Warehouse/Marketplace

**CustomerSupport** - Yes/No

So how to handle the situation

```
Option 1: Add it to Fact Table 

The problem is, Fact table data is not that important and sometimes won't make sense
```

<figure><img src="https://2629735788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3G2NQEHaUSzehWzaKvXK%2Fuploads%2Fg8Z6W8f6tFhAB1awGJVI%2Fimage.png?alt=media&amp;token=52d939a2-5542-47a6-9536-911d5308b2d8" alt=""><figcaption><p>src: aroundbi.com</p></figcaption></figure>

```
Option 2: Add it as Dimension Table

The problem is with more Dimension table adds more joins to your queries.
```

<figure><img src="https://2629735788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3G2NQEHaUSzehWzaKvXK%2Fuploads%2FECOltdItwYO759gKkdYO%2Fimage.png?alt=media&amp;token=d0d4367d-9092-4247-92ff-ef0d031a4a8f" alt=""><figcaption><p>src: aroundbi.com</p></figcaption></figure>

**Do you know how to take care of this situation?**

Let's create a new table with values from all possible combinations.

<figure><img src="https://2629735788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3G2NQEHaUSzehWzaKvXK%2Fuploads%2FT09TOj4NsHGff2QBHmtN%2Fjunk_dimension.png?alt=media&amp;token=d5023aff-ff52-4efe-90b3-5b3d9edf5d8f" alt=""><figcaption><p>Junk Dimension with ID</p></figcaption></figure>

So, the revised Fact Table looks like this

<figure><img src="https://2629735788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3G2NQEHaUSzehWzaKvXK%2Fuploads%2FazVk2i7BndnC6rQlDXQd%2Fimage.png?alt=media&amp;token=78233af2-b959-4ee9-b4ca-4ea3258f73ed" alt=""><figcaption></figcaption></figure>

* Basically to group low cardinality columns.
* If the values are too uncorrelated.
* Helps to keep the DW simple by minimizing the dimensions.
* Helps to improve the performance of SQL queries.

**Note**: If the resultant dimension has way too many rows, then don’t create a Junk dimension.
