# View: current_balance_performers2

**View Name:** current_balance_performers2
**Table Source:** `Derived from: Prod_Royalty_Accounting_Royalty_Accounting.Account, Prod_Royalty_Accounting_Royalty_Accounting.Account_Contract, Prod_Royalty_Accounting_Royalty_Accounting.Account_Payment_Term, Prod_Royalty_Accounting_Royalty_Accounting.Contract, Prod_Royalty_Accounting_Royalty_Accounting.Ledger_Account_Contract + 3 more`
**File Path:** `views/current_balance_performers2.view.lkml`

## Overview

- **File Size:** 4537 bytes
- **Lines of Code:** 135
- **Dimensions:** 17
- **Measures:** 0
- **Dimension Groups:** 0
- **Filters:** 0

## Dimensions

| Name | Type |
|------|------|
| `Account_ID` | string |
| `Account_Name` | string |
| `Contract_ID` | string |
| `Contract_Name` | string |
| `Contract_Type` | string |
| `Run_Controller_ID` | string |
| `Run_Controller_Name` | string |
| `Currency_Code` | string |
| `Current_Balance` | number |
| `Is_On_Hold` | string |
| `Hold_Start_Date` | date |
| `Hold_Reason` | string |
| `Sap_Company_Code` | string |
| `Sap_Profit_Center` | string |
| `Sap_Business_Group` | string |
| `Payment_Entity` | string |
| `Payment_Schedule` | string |

## Derived Table

```sql
sql:
       SELECT
    ac.account_id,
    a.account_name,
    c.contract_id,
    c.contract_name,
    c.contract_type,
    rcc.run_controller_id,
    rc.run_controller_name,
    apt.currency_code,
    IFNULL(lac.current_balance, 0) AS current_balance,
    ph.is_on_hold,
    ph.start_date as hold_start_date,
    ph.reason as hold_reason,
    pc.company_code AS sap_company_code,
    pc.profit_center AS sap_profit_center,
    pc.business_group AS sap_business_group,
    rpe.payment_entity_name,
    apt.payment_schedule
    FROM ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.contract AS c
    INNER JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.account_contract AS ac
    ON c.contract_id = ac.contract_id AND ac._fivetran_deleted = false
    INNER JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.account_payment_term AS apt
    ON ac.account_id = apt.account_id AND apt._fivetran_deleted = false
    INNER JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.account AS a
    ON ac.account_id = a.account_id and a._fivetran_deleted = false
    INNER JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.run_controller_contract AS rcc
    ON c.contract_id = rcc.contract_id and rcc._fivetran_deleted = false
    INNER JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.run_controller AS rc
    ON rc.run_controller_id = rcc.run_controller_id and rc._fivetran_deleted = false
    LEFT OUTER JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.ledger_account_contract_current_balance AS laccb
    ON c.contract_id = laccb.contract_id and laccb._fivetran_deleted = false
    LEFT OUTER JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.ledger_account_contract AS lac
    ON laccb.ledger_account_contract_id = lac.ledger_account_contract_id and lac._fivetran_deleted = false
    LEFT JOIN ORCHARD_APP_REPORTING_V2.prod_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.reference_payment_entity rpe
    ON apt.payment_entity_id = rpe.reference_payment_entity_id AND rpe._fivetran_deleted = false
    LEFT OUTER JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.payment_hold AS ph
    ON ph.account_id=a.account_id and ph._fivetran_deleted = false
    LEFT OUTER JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.reference_signing_entity AS rse
    ON rse.reference_signing_entity_id = c.reference_signing_entity_id AND rse._fivetran_deleted = false
    LEFT OUTER JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.reference_sap_profit_center AS pc
    ON pc.reference_sap_profit_center_id = rse.reference_sap_profit_center_id AND pc._fivetran_deleted = false
    WHERE c._fivetran_deleted = false
    AND c.contract_type = 'neighbouring_rights'
    AND rpe.reference_payment_entity_id in (3,4)
    AND a._fivetran_deleted = 'false';;
```

