# View: dt_store_backfill_priority

**View Name:** dt_store_backfill_priority
**Table Source:** `Derived from: Prod.Dim_Period, Prod.Dim_Release, Prod.Workstation_Fact_Sales_Unified_Dbt, Royalty_Accounting, Royalty_Accounting.Prod`
**File Path:** `dt_store_backfill_priority.view.lkml`

## Overview

- **File Size:** 3284 bytes
- **Lines of Code:** 106
- **Dimensions:** 8
- **Measures:** 2
- **Dimension Groups:** 0
- **Filters:** 2

## Comments & Notes

- Liquid Filter on Line 23
- Liquid Filter on Line 27

## Dimensions

| Name | Type |
|------|------|
| `release_id` | string |
| `upc` | string |
| `release_name` | string |
| `ingestion_completed` | date |
| `artist_name` | string |
| `label_id` | number |
| `label_name` | string |
| `is_priority` | yesno |

## Measures

| Name | Type |
|------|------|
| `gross_revenue_usd` | sum |
| `distinct_upc` | count_distinct |

## Filters

- `date_range`
- `revenue_threshold`

## Derived Table

```sql
sql:
      SELECT
          base.*,
          r.upc,
          r.release_name,
          TO_DATE(r.ingestion_completed) AS ingestion_completed,
          ai.name AS artist_name,
          v.vendor_id AS label_id,
          IFF(v.company IS NULL OR v.company = '', v.name, v.company) AS label_name,
          IFNULL(mp.is_priority, FALSE) AS is_priority
      FROM (
          SELECT release_id, SUM(gross) AS gross_revenue_usd
          FROM (
              SELECT
                  DATE_FROM_PARTS(dp.year, dp.month, '01') AS accounting_month,
                  dr.product_id AS release_id,
                  SUM(fs.gross) AS gross
              FROM royalty_accounting.prod.workstation_fact_sales_unified_dbt fs
                  INNER JOIN facts.prod.dim_release dr ON fs.releaseid = dr.releaseid
                  INNER JOIN facts.prod.dim_period dp ON fs.accountingperiodid = dp.periodid
              WHERE {% condition date_range %
```

