Using and editing explorations
Last updated
Last updated
Objectives: in this exercise we will learn how to filter a query, create a metric, create a calculated metric and use the chart formatting options. In this article we will learn about:
In this exercice we want to :
Add the amount of payment paid with Gift cards per month
Start by duplicating the initial tile from the training dashboard, then:
Replace the measure "Number of orders" with "Total payment amount"
Add a filter on the query editor: Payment method equals gift card
Great, now we can see the amount paid each week by gift card. However, having a filter at the chart level is not optimal as it does not allow other users to easily re-use this metric.
We will create a new metric corresponding to the payments with gift card:
Edit your exploration by clicking on "Edit in workbench"
Create a new metric under the payment table
The metric should be a sum of the column "amount"
Filter on payment method gift_card
Give your metric a name: Payments with gift card
Set the metric type as number, and add $ as a suffix
Now we can add our new metric to our chart and run the query. We can see that the two measures are displayed, but are equals.
This is because we still have the filter at the chart level. Let's remove it and run the query again: now we can see both the total payment amount and the total payment amount by gift card side by side.
Now imagine we want to add the percentage of payment made by gift card on our chart. To do so :
go to the exploration edition page in the workbench
click on the + sign next to Payment in the left side panel
click on Add a calculated metric
In the formula editor, type :
Payments with gift card / Total payment amount
Give your metric a name, for example : %age of payment amount with gift card, and set the type as percentage in the advanced settings. Save your metric. Now add this metric to the chart and click on run query.
The metric is added to our chart, but is too small to be visible. In order to fix, we will need to edit our chart options.
In the right panel:
Toggle "labels" to display labels
Enable the right axis
Assign the % of gift card payment to this right axis, and change it's type to Area