# View: dt_potential_double_booked_transactions_distro

**View Name:** dt_potential_double_booked_transactions_distro
**Table Source:** `Derived from: Orchard_App_Reporting_V2, Orchard_App_Reporting_V2.Prod_Royalty_Accounting_Royalty_Accounting, Prod.Accounting_Run_Results_Distro_Staging, Prod_Royalty_Accounting_Royalty_Accounting.Accounting_Period, Prod_Royalty_Accounting_Royalty_Accounting.Accounting_Run + 2 more`
**File Path:** `views/dt_potential_double_booked_transactions_distro.view.lkml`

## Overview

- **File Size:** 11528 bytes
- **Lines of Code:** 414
- **Dimensions:** 53
- **Measures:** 0
- **Dimension Groups:** 0
- **Filters:** 0

## Dimensions

| Name | Type |
|------|------|
| `account_id` | number |
| `contract_id` | number |
| `contract_txn_id` | number |
| `txn_id` | number |
| `accounting_run_id` | number |
| `accounting_run_name` | string |
| `term_rate` | string |
| `unit_price_sale_currency` | string |
| `gross_revenue_sale_currency` | string |
| `withholding_tax_sale_currency` | string |
| `gross_revenue_after_withholding_tax_sale_currency` | string |
| `net_revenue_sale_currency` | string |
| `distribution_fee_sale_currency` | string |
| `unit_price_payee_currency` | string |
| `gross_revenue_payee_currency` | string |
| `withholding_tax_payee_currency` | string |
| `gross_revenue_after_withholding_tax_payee_currency` | string |
| `net_revenue_payee_currency` | string |
| `distribution_fee_payee_currency` | string |
| `stmt_db_sales_distro_txn_id` | number |
| `unique_detail_id` | number |
| `sales_file_id` | number |
| `batch_id` | string |
| `statement_id` | number |
| `start_date` | string |
| `transaction_date` | string |
| `store_id` | string |
| `subdistributor` | string |
| `sale_currency_code` | string |
| `sale_currency_code_id` | number |
| `activity_rate` | string |
| `country_id` | number |
| `configuration` | string |
| `transaction_type` | string |
| `transaction_type_id` | number |
| `transaction_subtype_id` | number |
| `label_id` | number |
| `upc` | string |
| `cd` | number |
| `track_id` | number |
| `isrc` | string |
| `track_name` | string |
| `video_id` | number |
| `quantity` | number |
| `unit_price_usd` | string |
| `total_usd` | string |
| `withholding_tax_usd` | string |
| `retail_price_usd` | string |
| `original_price_usd` | string |
| `discount_usd` | string |
| `phys_ppd_usd` | string |
| `is_excluded_from_sap` | string |
| `actual_statement_number` | string |

## Derived Table

```sql
sql:
      WITH duplicate_txn AS (
          SELECT arrds.TXN_ID, COUNT(arrds.TXN_ID)
          FROM ROYALTY_ACCOUNTING.PROD.ACCOUNTING_RUN_RESULTS_DISTRO_STAGING arrds
          JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.ACCOUNTING_RUN ar
              ON ar.ACCOUNTING_RUN_ID = arrds.ACCOUNTING_RUN_ID
          JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.ACCOUNTING_PERIOD ap
              ON ap.ACCOUNTING_PERIOD_ID = ar.ACCOUNTING_PERIOD_ID
          WHERE ap.STATEMENT_PERIOD_ID = {% parameter statement_period_id %
```

