> For the complete documentation index, see [llms.txt](https://help.whaly.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.whaly.io/training/for-builders/using-and-editing-explorations.md).

# Using and editing explorations

**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:&#x20;

### Filtering a query

In this exercice we want to :&#x20;

> Add the amount of payment paid with Gift cards per month

Start by duplicating the initial tile from the training dashboard, then:&#x20;

1. Replace the measure "**Number of orders**" with "**Total payment amount**"
2. Add a filter on the query editor: Payment method equals gift card

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

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.&#x20;

### Creating a filtered metric

We will create a new metric corresponding to the payments with gift card:&#x20;

1. Edit your exploration by clicking on "Edit in workbench"
2. Create a new metric under the payment table&#x20;
   1. The metric should be a sum of the column "amount"
   2. Filter on payment method **gift\_card**
   3. Give your metric a name: **Payments with gift card**
   4. Set the metric type as number, and add $ as a suffix

<figure><img src="/files/6ThvDJPAZlc4898OQGn5" alt=""><figcaption></figcaption></figure>

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.&#x20;

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.

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

### Creating a calculated metric

Now imagine we want to add the percentage of payment made by gift card on our chart. To do so :&#x20;

1. go to the exploration edition page in the workbench
2. click on the + sign next to Payment in the left side panel
3. click on Add a calculated metric
4. In the formula editor, type :&#x20;

> 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.&#x20;

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.

### Formatting our chart

In the right panel:&#x20;

1. Toggle "**labels**" to display labels
2. Enable the right axis
3. Assign the **% of gift card payment** to this right axis, and change it's type to **Area**

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://help.whaly.io/training/for-builders/using-and-editing-explorations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
