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

# Discounts

> Every discount used on an order, automatic ones included, by the order day: the amount taken off and the orders it was used on, by discount name, code, method, class and type.

Every discount used on an order, automatic ones included, by the order day: the amount taken off and the orders it was used on, by discount name, code, method, class and type.

## Example

```sql theme={null}
FROM discounts
  SHOW applied_discounts, discounted_orders
  GROUP BY discount_name
  SINCE startOfMonth(-1m) UNTIL today
  ORDER BY applied_discounts DESC
```

## Metrics

| Metric | Type | Description |
| - | - | - |
| `applied_discounts` | Currency | The amount taken off by the discount, as Shopify reports it (a negative amount). |
| `discounted_orders` | Number | Orders the discount was used on, each counted once. |
| `product_and_order_discounts_from_apps` | Currency | What apps' discounts took off products and orders. |
| `shipping_discounts_from_apps` | Currency | What apps' discounts took off shipping. |
| `average_discount_per_order` | Currency | The applied discount per discounted order. |

## Dimensions

| Dimension | Description |
| - | - |
| `discount_name` | The code or title that identifies the discount. |
| `discount_title` | The discount's title when it was applied. |
| `discount_code` | The code entered, if any. |
| `discount_method` | How the discount was applied: Automatic, Manual, Discount code or Script. |
| `discount_class` | What it applied to: Order, Product or Shipping. |
| `discount_type` | Fixed amount or Percentage. |
| `order_name` | The order the discount was used on. |

## Filters

| Filter | Type | Description |
| - | - | - |
| `discount_title` | Text | The discount's title when it was applied. |
| `discount_code` | Text | The code entered, if any. |
| `discount_method` | Text | How the discount was applied: Automatic, Manual, Discount code or Script. |
| `discount_class` | Text | What it applied to: Order, Product or Shipping. |
| `discount_type` | Text | Fixed amount or Percentage. |
| `order_name` | Text | The order the discount was used on. |
| `discount_name` | Text | The code or title of the discount. |

## Linked records

Fields of the records this dataset reaches can be shown, grouped by and filtered on, written with a dot after the record (for example `order.name`). Each record's page lists its fields.

| Write | Record | Reached through |
| - | - | - |
| `order.<field>` | [Order](https://docs.queryful.app/queryfulql/records/order.md) | Order |
| `order.customer.<field>` | [Customer](https://docs.queryful.app/queryfulql/records/customer.md) | Order › Customer |
| `order.customer.company.<field>` | [Company](https://docs.queryful.app/queryfulql/records/company.md) | Order › Customer › Company |
| `order.company.<field>` | [Company](https://docs.queryful.app/queryfulql/records/company.md) | Order › Company |
| `order.company_location.<field>` | [Company location](https://docs.queryful.app/queryfulql/records/company_location.md) | Order › Company location |
| `order.company_location.company.<field>` | [Company](https://docs.queryful.app/queryfulql/records/company.md) | Order › Company location › Company |
| `order.location.<field>` | [Location](https://docs.queryful.app/queryfulql/records/location.md) | Order › Location |
| `order.market.<field>` | [Market](https://docs.queryful.app/queryfulql/records/market.md) | Order › Market |
| `shop.<field>` | [Store](https://docs.queryful.app/queryfulql/records/shop.md) | Store |

## Related datasets

* [Draft orders](https://docs.queryful.app/queryfulql/datasets/draft_orders.md)
* [Discount catalogue](https://docs.queryful.app/queryfulql/datasets/discount_catalog.md)
* [Abandoned checkouts](https://docs.queryful.app/queryfulql/datasets/abandoned_checkouts.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.