# Heatmap

<table data-card-size="large" data-view="cards"><thead><tr><th data-card-target data-type="content-ref"></th><th data-hidden></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><a href="#auto-heatmap">#auto-heatmap</a></td><td></td><td></td><td></td><td><a href="https://4045370218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0xzzR5x0BnQ6kHixlzd%2Fuploads%2F0S3zc6h8stOZoNpPVf6b%2Fauto_heatmap_example.jpg?alt=media&#x26;token=e9a40c3e-4866-4384-941b-8921aedc3a42">auto_heatmap_example.jpg</a></td></tr></tbody></table>

## Auto Heatmap

When 2 string columns and 1 numeric column exists

```sql
-- @title: Auto Heatmap
-- @subtitle: An example auto generated heatmap comparing two categories
SELECT
Owner,
Channel,
count(*) as Sales
FROM Sales
WHERE Sales.Status = 'Won'
GROUP BY Owner, Channel
```

<figure><img src="https://4045370218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0xzzR5x0BnQ6kHixlzd%2Fuploads%2F0S3zc6h8stOZoNpPVf6b%2Fauto_heatmap_example.jpg?alt=media&#x26;token=e9a40c3e-4866-4384-941b-8921aedc3a42" alt=""><figcaption><p>An example auto generated heatmap chart</p></figcaption></figure>

| OWNER   | CHANNEL  | SALES |
| ------- | -------- | ----- |
| Earl    | search   | 2.0   |
| Bernard | coldcall | 5.0   |
| Oliver  | event    | 3.0   |
| Oliver  | coldcall | 1.0   |
| Carrie  | search   | 9.0   |
| Norbit  | referral | 3.0   |
| Norbit  | event    | 5.0   |
| Norbit  | search   | 2.0   |
| Bernard | referral | 25.0  |
| Artie   | referral | 50.0  |
| Devon   | referral | 12.0  |
| Max     | event    | 4.0   |
| Norbit  | pr\_ad   | 1.0   |
| Carrie  | pr\_ad   | 3.0   |
| Norbit  | coldcall | 1.0   |
| Bernard | search   | 7.0   |

##
