# Creating explorations and models

**Objectives:** in this exercise we will learn how to create an exploration, and how to create and use models

### Creating an exploration&#x20;

In this exercise we need to:

> Add the number of customers per number of orders

Until now we were using the Order exploration, that was getting data from the order table.

Here, we want to have a chart representing the number of customer per number of order. Some customers may not have placed an order, and we want to count them. So we will need to start our exploration from the customer table and group our customer per number of order.<br>

Let's create our exploration :&#x20;

* Head to the Workbench
* Click on the + the "Add an exploration"
* Select your Jaffle Shop customer table

<figure><img src="/files/YsnlwrUXKm7kbcFX1eLX" alt=""><figcaption></figcaption></figure>

On our new exploration, we need to have :&#x20;

* The number of customers as a metric
* The number of orders as a dimension.

This number of order columnis not available in the customer table, but we know we have the data in our database. We have a modelization problem, meaning that the data we have is not in a format that allows our analysis. We will create a data model to overcome this problem and create our chart.

## Creating our data model

In the workbench, go to the dataset tab and create a new model. We will create a flow (no-code) model that will start from the customer table of Jaffle shop :&#x20;

<figure><img src="/files/864nW68O6JHv53R649Kj" alt=""><figcaption></figcaption></figure>

Now we can go the the configuration tab of our model to add calculated columns to our Customer table.

For example let's create a full\_name column that will contain the first name and last name of our customer. We will use the CONCAT formula in order to do so :&#x20;

<figure><img src="/files/Ar5fiMdlBJXqGq8htfK5" alt=""><figcaption></figcaption></figure>

To add the number of order per customer, we will use a rollup column (which consists of a lookup that matches multiple results in a related table and aggregates these results) :&#x20;

<figure><img src="/files/s2lEceMGiz2jDyX2peJ6" alt=""><figcaption></figcaption></figure>

That's it, now we just need to save our model before being able to use this column in our exploration. To do it, set the output on the last step and click on save.

## Updating our exploration

We will need to update our exploration to make it use our new "Customer model" instead of the raw customer table. To do so :&#x20;

* Go to the exploration
* Click on the customer table, and replace the raw data table with your model
* Create your dimensions and metrics

<figure><img src="/files/OOUZHrtcK89bpjp9j0WP" alt=""><figcaption></figcaption></figure>

## Creating our chart

We can now create our chart using these metrics and dimensions

<figure><img src="/files/W72KBxuYIZ0pRNNUGl3i" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: 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:

```
GET https://help.whaly.io/training/for-builders/creating-explorations-and-models.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
