> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usedatabrain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Metric Expression for Single Value Card

> This guide is essential to enhance dashboards by leveraging Metric Expressions for single-value cards.

> Metric Expressions allow you to perform calculations using single-value card metrics by referencing their values with their **Metric IDs**.

> **Example:**

> We have two single value cards:
>
> * Sales with Metric ID `{{Sales_hwPED}}`, valued at **\$2.89B**
> * Profit with Metric ID `{{Profi_qjvSWB}}`, valued at **\$2.84B**

> To calculate the Sales Profitability Ratio, we can use a Metric Expression:
>
> * `ROUND({{Sales_hwPED}}/{{Profi_qjvSWB}}, 2)`\
>   Output: A single-value card displaying **1.02**

> Alternatively using,\
> `{{Sales_hwPED}}` / `{{Profi_qjvSWB}}`\
> Output: A single-value card displaying\
> **2891075848.0202847 / 2840122818.152845**

***

### 1. **Access Elements**

Navigate to your dashboard and click on **"+ Elements"** button near the create metric button.

<Frame>
  <img src="https://mintcdn.com/databrainlabs-bef6850a/3OVuv1yincv0D6pa/images/guides/access-elements2.png?fit=max&auto=format&n=3OVuv1yincv0D6pa&q=85&s=006ac41820dabf3802be7ab1050faee0" alt="Accessing the Elements menu to create a new metric expression" width="2940" height="1654" data-path="images/guides/access-elements2.png" />
</Frame>

### 2. **Configure Metric Expression**

* Enter your suitable title and description for the metric expression.
* Choose the Element Type as **"Metric Expression"**.
* Select the metrics you want to include in the computation.
* In the **"Metric Expression"** text box, write the formula to be applied to the chosen single-value cards.
  > Reference the value of a single-value card using its **Metric ID** like `{{metricid}}`
* Customize the appearance of the single-value card using font options such as **font family**, **font size**, and **font weight**.
* (Optional) Enable **"Merge Card to Background"** if you want to blend the metric into the dashboard background.
* Click **"Save"** to complete the setup.

<Frame>
  <img src="https://mintcdn.com/databrainlabs-bef6850a/3OVuv1yincv0D6pa/images/guides/configure-metric-expression.png?fit=max&auto=format&n=3OVuv1yincv0D6pa&q=85&s=49edd2da72f3c9e11af7fc8d46e2d76d" alt="Configuring a metric expression by selecting metrics and entering the formula" width="2940" height="1658" data-path="images/guides/configure-metric-expression.png" />
</Frame>

### 3. **View the Metric Expression**

Once saved, your Metric Expression will be displayed on the dashboard, reflecting the computed value based on the selected metrics.

<Frame>
  <img src="https://mintcdn.com/databrainlabs-bef6850a/hRxI-z391a3Ay8M5/images/guides/view-metric-expression.png?fit=max&auto=format&n=hRxI-z391a3Ay8M5&q=85&s=eb03c4d0b75c966cd5b746c13eaca623" alt="Viewing the computed metric expression displayed as a single-value card" width="2940" height="1654" data-path="images/guides/view-metric-expression.png" />
</Frame>

<Info>Metric Expression works only for single value cards!</Info>

<Check>
  You’ve successfully created a Metric Expression for your dashboard!\
  Your single-value cards can now perform real-time calculations, enabling smarter comparisons and deeper analytical insights.
</Check>
