# Card Component - Display Sales - Today vs. Yesterday

> This example is easily customized for your use case. Here, a client requested to view a comparison of sales between today and yesterday. This way, they…

Source: https://tadabase.com/docs/snippets/card-component-display-sales-today-vs-yesterday  
Status: Not yet re-checked. Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

![Screenshot for “Card Component - Display Sales - Today vs. Yesterday”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/2022-09-03_13-52-57.png)

This example is easily customized for your use case. Here, a client requested to view a comparison of sales between today and yesterday. This way, they have a quick visual of how their sales compare.

**Step 1**

**Add a custom component to any page you wish to display the card.**

![Screenshot for “Card Component - Display Sales - Today vs. Yesterday”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/2022-09-03_13-57-39.png)

**Step 2**

**Choose the option of summary.**

![Screenshot for “Card Component - Display Sales - Today vs. Yesterday”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/2022-09-03_13-59-53.png)

**Step 3**

**Now you need to open your custom card component—Select Data Source, then Calculations. You will set up your card calculations with the settings shown in the image below.**

![Screenshot for “Card Component - Display Sales - Today vs. Yesterday”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/2022-09-03_14-01-40.png)

**Step 4**

**Next, select the template tab and add the following code.**

> **Note:** I selected Card 5 from our custom component library template section for this example.

```
{{#each records}}

    <div class="card-style-custom-4 card-custom-header-border col col-md-12">
        <div class="card-custom-4-wrap">
            <div class="card-custom-4-header">
                <span>Sales</span>
            </div>
            <div class="card-custom-4-inner">
                <span class="card-custom-4-icon"><i class="far fa-users"></i></span>
                <span class="card-custom-4-value"><b>${{totalToday}}</b></span>
                <span class="card-custom-4-suffix">Total Today</span>
            </div>
            <div class="card-custom-4-footer">
                {{#gte totalYesterday totalToday}}
                    <span class="lower">?? ${{totalYesterday}} Yesterday</span>
{{else}}
    <span class="higher">?? ${{totalYesterday}} Yesterday</span>
                {{/gte}}
            </div>
        </div>

{{/each}}
```

> **Note:** To select emojis to customize, press the windows ?'s button + period "."

![Screenshot for “Card Component - Display Sales - Today vs. Yesterday”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/2022-09-03_14-06-26.png)

> **Note:** Please remember to change the areas I have highlighted above to match the information you wish to use. My choice of totalToday and totalYesterday would need to be replaced by the field name you titled in the data source in step 3.

**Step 5**

**Within the code, I have added classes to the span. Let's go down to the very bottom of the code in our CSS tab and add some CSS to change the color of the text based on this calculation.**

```
.lower {
    color: red;
}
.higher {
    color: green;
}
```

![Screenshot for “Card Component - Display Sales - Today vs. Yesterday”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/2022-09-03_14-30-35.png)

**Now you have a beautiful card component to calculate the information!**

**Original Community Post:**

[https://community.tadabase.io/t/how-to-display-sales-difference-between-today-and-yesterday/2094/8](https://community.tadabase.io/t/how-to-display-sales-difference-between-today-and-yesterday/2094/8)
