# View: KNR_Ownership_Prod_PostApproval_Doublebooking

**View Name:** KNR_Ownership_Prod_PostApproval_Doublebooking
**Table Source:** `Derived from: Prod.Vw_Abacus_Fact_Sales_Distro_V2, Royalty_Accounting, Royalty_Accounting.Prod`
**File Path:** `views/KNR_Ownership_Prod_PostApproval_Doublebooking.view.lkml`

## Overview

- **File Size:** 1863 bytes
- **Lines of Code:** 82
- **Dimensions:** 11
- **Measures:** 1
- **Dimension Groups:** 0
- **Filters:** 0

## Dimensions

| Name | Type |
|------|------|
| `Current_Batch_ID` | string |
| `Statement_Period_ID` | string |
| `Run_Controller_ID` | string |
| `Account_ID` | string |
| `Contract_ID` | string |
| `TXN_ID` | string |
| `ISRC` | string |
| `Sale_Currency_Code` | string |
| `Store_ID` | string |
| `Transaction_Types` | string |
| `Transaction_Count` | number |

## Measures

| Name | Type |
|------|------|
| `Gross_Revenue_Sale_Currency` | sum |

## Derived Table

```sql
sql:

select
f.current_batch_id,
f.statement_period_id,
f.run_controller_id,
f.account_id,
f.contract_id,
f.txn_id,
f.isrc,
f.sale_currency_code,
f.store_id,
listagg(distinct f.transaction_type, ',') transaction_types,
count(*) transaction_count,
sum(f.gross_revenue_sale_currency) gross_revenue_sale_currency
from royalty_accounting.prod.vw_abacus_fact_sales_distro_v2 f
join (SELECT
        unique_detail_id,
        count(*)
      FROM ROYALTY_ACCOUNTING.PROD.VW_ABACUS_FACT_SALES_DISTRO_V2  AS vw_abacus_fact_sales_distro
      group by 1
having count (*) > 1) dup_fs on f.unique_detail_id = dup_fs.unique_detail_id
group by 1,2,3,4,5,6,7,8,9


        ;;
```

