> For the complete documentation index, see [llms.txt](https://presight.gitbook.io/presight-v1.0/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://presight.gitbook.io/presight-v1.0/model/custom-tables/table-builder/advanced-enrichment-segmentation.md).

# Advanced Enrichment - Segmentation

## How to use Cube Builder

The following example will help you to understand how to create a cube/ a table and use it in the workspace.

For instance, you need to know if the customers buying goods in the given month also had orders in the last month, to analyze the continuity in buying behaviors of the customers. So, you need to classify the current buying customers in two groups: "Buy in 2 consecutive months" and "Only buy this month".

Follow the steps to create a table with the given condition:

* Create a new cube from left-side panel or from the breakdown menu; name the table "<mark style="color:blue;">Continuity Status</mark>"
* Add the following columns into the table. If the inputs are just taken from raw table data, drag them from the side list and drop them to the table. If the inputs need to be calculated, use formulas (formula list is in the next section).
  * Column 1: <mark style="color:blue;">**Customer ID**</mark> from **Invoices** table - this is raw data, just drag and drop; name the Column "<mark style="color:orange;">Customer ID</mark>"
  * Column 2: the analysis requires monthly status so Invoice month should be shown by using formula: <mark style="color:purple;">MONTH(Invoice Date)</mark> - choose Invoice Date from table **Invoices**; name the Column "<mark style="color:orange;">Invoice Month</mark>"
  * Column 3: count Invoice in the given month, using formula: <mark style="color:purple;">COUNT(Invoice ID, Invoice Date)</mark>  - choose Invoice ID and Invoice Date from table **Invoices**; name the Column "<mark style="color:orange;">Invoice Count this month</mark>"
  * Column 4: check if there is any invoice in the previous month of  the given month, using formula: <mark style="color:purple;">PREVIOUS(Invoice Count this month, Invoice Month, Customer ID)</mark> - <mark style="color:orange;">Invoice Count this month, Invoice Month</mark> and <mark style="color:orange;">Customer ID</mark> are the columns that have been created from table <mark style="color:blue;">Continuity Status</mark>; name the Column "<mark style="color:orange;">Invoice Count previous month</mark>"
  * Column 5: name the status, using formula: IF<mark style="color:purple;">(Invoice Count previous month<>0&\&Invoice Count previous month<>NULL, "Buy in 2 months", "Only buy this month")</mark>; name the Column "<mark style="color:orange;">Continuity Status</mark>"

Here below is the result:

* Then, <mark style="color:blue;">Save Table</mark>
* Before saving, you can check and change Table name, Description and choose to show or hide any of the columns of the newly created table.

<figure><img src="https://133649292-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIYMCWeQmo9kVg5C6SOyv%2Fuploads%2FR3mMZPJo2DMaNrHN5cRI%2Fimage.png?alt=media&amp;token=09d1a148-c84d-4e21-8731-37638280514c" alt="" width="563"><figcaption></figcaption></figure>

* After saving the cube, you can find the cube and its dimensions in the dimension list when breaking-down:

<figure><img src="https://133649292-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIYMCWeQmo9kVg5C6SOyv%2Fuploads%2F9HfOM475HaHT9jbSFjnG%2Fimage.png?alt=media&amp;token=33faa843-82e0-4a5b-8cb8-6c04deb30edd" alt=""><figcaption></figcaption></figure>

* You can breakdown any metrics that have relationship with the table(s) you use in the cube. In the example, we can breakdown Sales, Buying Customer Count, Order Count and others:

<figure><img src="https://133649292-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIYMCWeQmo9kVg5C6SOyv%2Fuploads%2Fmvwads8wSh8c9HSjCWqf%2Fimage.png?alt=media&amp;token=b793ab5c-7426-4918-8c48-263344253c65" alt=""><figcaption></figcaption></figure>

## Supporting Formulas in Cube Builder
