Creating explorations and models
Last updated
Last updated
Objectives: in this exercise we will learn how to create an exploration, and how to create and use models
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.
Let's create our exploration :
Head to the Workbench
Click on the + the "Add an exploration"
Select your Jaffle Shop customer table
On our new exploration, we need to have :
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.
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 :
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 :
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) :
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.
We will need to update our exploration to make it use our new "Customer model" instead of the raw customer table. To do so :
Go to the exploration
Click on the customer table, and replace the raw data table with your model
Create your dimensions and metrics
We can now create our chart using these metrics and dimensions