# View: dt_per_play_rate_by_country

**View Name:** dt_per_play_rate_by_country
**Table Source:** `INTELLIGENCE.DBT_PROD.DT_PER_PLAY_RATE_BY_COUNTRY`
**File Path:** `dt_per_play_rate_by_country.view.lkml`

## Overview

- **File Size:** 1080 bytes
- **Lines of Code:** 38
- **Dimensions:** 2
- **Measures:** 0
- **Dimension Groups:** 0
- **Filters:** 0

## Comments & Notes

- derived_table: {
- WITH accounting_months AS (
- SELECT DISTINCT accountingperiodid

## Dimensions

| Name | Type |
|------|------|
| `country` | string |
| `per_play_rate` | number |

## Derived Table

```sql
#     sql:
# WITH accounting_months AS (
#     SELECT DISTINCT accountingperiodid
#     FROM royalty_accounting.prod.workstation_fact_sales_unified_dbt
#     ORDER BY 1 DESC
#     LIMIT 3
# ),
# group_by_country AS (
#     SELECT
#         fs.countryid,
#         SUM(fs.sales) AS units,
#         SUM(fs.gross) AS gross
#     FROM accounting_months am
#         INNER JOIN royalty_accounting.prod.workstation_fact_sales_unified_dbt fs ON am.accountingperiodid = fs.accountingperiodid
#     WHERE storeid IN (1,286) AND transactiontypeid IN (1,10)
#     GROUP BY 1
# )
# SELECT
#     dc.countryname AS country,
#     (gross / units * 1000) AS per_play_rate
# FROM group_by_country gbc
#     INNER JOIN facts.prod.dim_country dc ON gbc.countryid = dc.countryid ;;
#
```

