# Aggregation metrics

After you [finish **Step 1 (Metric Info)**](..#step-1-metric-info), **Step 2 (Configure Metric)** appears in the main form:

<figure><img src="https://3772145110-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7hLPjNTyFMw1VTOP6ZnD%2Fuploads%2FMV6cuMSjfUK87sTq10fl%2Fnew-agg-custom-metric.png?alt=media&#x26;token=2387ace8-3400-445b-a231-673f33a9d1b0" alt="Step 2 (Configure Metric) of metric configuration for an Aggregation metric"><figcaption></figcaption></figure>

1. Under **Select data asset**, select a datasource, schema, table, and column. Note that when you select a table, the settings under **Configure metric** inherit values from that table.
2. Under **Aggregation function**, choose a function to apply to the column's values.
3. Optionally, to create a WHERE clause select **Add +**. New fields appear under **Where clause** that you can use to specify the necessary condition. To delete a WHERE clause, use the waste bin icon beside it to the right.&#x20;

![](https://3772145110-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7hLPjNTyFMw1VTOP6ZnD%2Fuploads%2F4ebGbembD24I0ATuDxYq%2Fdel-whereclause.png?alt=media\&token=07fd7548-7a95-4ca9-9933-787460cc3e32)

4\.  Under **Configure metric**, review the inherited settings. To use your own values, select **Override Settings** to unlock the settings for editing.  Note that if the table you chose has partitions, Lightup detects them and displays relevant settings for them just below the heritable settings.&#x20;

{% hint style="info" %}
For help deciding what values to use, see the list of options under [Manage Table Settings](../../prepare-tables-for-data-quality-metrics#manage-table-settings).
{% endhint %}

5\. Optionally, select a column to use for slices. This can significantly improve your metric's query performance. Use the gear icon to set how the slice affects the metric's query.&#x20;

6\. After you finish configuring your new metric, select **Create** at the top right corner to proceed to **Step 3 (Preview)**.

### Step 3 (Preview)

![](https://3772145110-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7hLPjNTyFMw1VTOP6ZnD%2Fuploads%2Fyc1uVoEbOGv1sqhr7HFU%2Fagg-custom-preview.png?alt=media\&token=6cbb8b97-f859-465f-ba0f-746cff00c468)

{% hint style="info" %}
If you're editing an existing metric, you'll see an option to view the metric's query recent history.
{% endhint %}

1. Select **View sample data** to see a sample set of 100 rows from the data asset. When you're done, select **Stop Viewing**.&#x20;
2. Optionally, adjust the date range for the preview. If you adjust the range, you must pick a start date and an end date.
3. Select **Preview** to generate a chart of the metric using the specified date range.&#x20;

{% hint style="info" %}
To adjust the metric configuration after previewing, select the pencil icon next to **Data Asset** in the left nav pane.
{% endhint %}

4\. After you're satisfied with the preview, select **Create** at the top right corner. The Explorer tab opens and displays your new metric in the Explorer tree.&#x20;
