--- title: Calculated metric card example slug: n62d0198 canonical_url: https://docs.coveo.com/en/n62d0198/ collection: coveo-analytics source_format: adoc --- # Calculated metric card example This article provides an example of a complete SQL query relating to a [calculated metric card](https://docs.coveo.com/en/1972#calculated-metric). A calculated metric card can be found in a [dashboard](https://docs.coveo.com/en/256/) on the [**Reports**](https://platform.cloud.coveo.com/admin/#/orgid/usage/reports/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/usage/reports/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/usage/reports/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/usage/reports/)) page of the [Coveo Administration Console](https://docs.coveo.com/en/183/). The card functions by using either two existing metric card values, or a number and a metric card value, in the calculation. Therefore, prior to creating a calculated metric card, at least one other card is required. For example, in the following dashboard, a calculated metric card was added by taking the existing metrics cards, `Search Event Count` and `Custom Event Count`. ![Calculated metric card configuration panel in dashboard | Coveo](https://docs.coveo.com/en/assets/images/coveo-analytics/edit-calculated-metric-card-in-dashboard.png) You can reproduce the same result by using the same calculation in a SQL query. To do so, wrap the query related to each card with the `WITH` clause, and use a `SELECT` statement to apply the metric card operator defined in the calculated metric card, which is based on both cards: ```sql ALTER SESSION SET timezone = 'America/New_York'; WITH cte_searches as ( -- Left card SELECT count(distinct "search_id") as search_event_count FROM "COVEO"."ua"."searches_shared" WHERE convert_timezone('UTC', 'America/New_York', "datetime") between '2023-05-07' and '2023-06-06' ) , cte_clicks as ( -- Right card SELECT count(distinct "click_id") as click_event_count FROM "COVEO"."ua"."clicks_shared" WHERE convert_timezone('UTC', 'America/New_York', "datetime") BETWEEN '2022-11-01 00:00:00.000'::TIMESTAMP_TZ AND '2022-12-01 23:59:59.999'::TIMESTAMP_TZ ) SELECT -- Apply the operator between both cards (SELECT click_event_count FROM cte_clicks) / (SELECT search_event_count FROM cte_searches) as click_to_search_ratio; ```