# View: dt_finance_advance_recouped_balances

**View Name:** dt_finance_advance_recouped_balances
**Table Source:** `Derived from: Art_Relations_Prod_Art_Relations.Owner, Orchard_App_Reporting_V2.Art_Relations_Prod_Art_Relations, Prod.Vw_Dim_Abacus_Ar_Vendor, Prod.Workstation_Fact_Sales_Unified_Dbt, Royalty_Accounting + 3 more`
**File Path:** `dt_finance_advance_recouped_balances.view.lkml`

## Overview

- **File Size:** 6296 bytes
- **Lines of Code:** 186
- **Dimensions:** 7
- **Measures:** 1
- **Dimension Groups:** 0
- **Filters:** 0

## Comments & Notes

- Or, you could make this view a derived table, like this:
- Create primary_key dimension from our new field

## Dimensions

| Name | Type |
|------|------|
| `primary_key` | string |
| `labelid` | string |
| `label_name` | string |
| `owner_name` | string |
| `advances` | number |
| `recoupable_costs` | number |
| `adjustment_category` | string |

## Measures

| Name | Type |
|------|------|
| `adjustment_amount` | sum |

## Derived Table

```sql
sql:

WITH actual_net AS (
  SELECT
      fs.labelid,
      IFF(v.company IS NULL OR v.company  = '',  v.name, v.company) AS label_name,
      o.owner_name,
      SUM(fs.actual_net) AS actual_net
  FROM royalty_accounting.prod.workstation_fact_sales_unified_dbt fs
  INNER JOIN royalty_accounting_reporting.prod.vw_dim_abacus_ar_vendor v ON v.vendor_id=fs.labelid
  INNER JOIN orchard_app_reporting_v2.art_relations_prod_art_relations.owner o ON o.owner_abbrivation=v.owner
  WHERE accountingperiodid <= {% parameter period_id %
```

