# View: manual_adjustment_usd_and_ccur_reserves_withheld

**View Name:** manual_adjustment_usd_and_ccur_reserves_withheld
**Table Source:** `Derived from: Art_Relations_Prod_Art_Relations.Currencies, Art_Relations_Prod_Art_Relations.Currency_Exchange_Rates, Orchard_App_Reporting_V2.Art_Relations_Prod_Art_Relations, Prod.Vw_Abacus_Manual_Adjustment, Prod.Vw_Dim_Abacus_Ar_Booked_Vendor_Contract_Snapshot + 3 more`
**File Path:** `manual_adjustment_usd_and_ccur_reserves_withheld.view.lkml`

## Overview

- **File Size:** 2065 bytes
- **Lines of Code:** 83
- **Dimensions:** 5
- **Measures:** 3
- **Dimension Groups:** 0
- **Filters:** 1

## Dimensions

| Name | Type |
|------|------|
| `labelid` | number |
| `primary_key` | number |
| `category_id` | number |
| `apply_to_period_id` | number |
| `payout_currency_code` | string |

## Measures

| Name | Type |
|------|------|
| `reserves_usd` | sum |
| `reserves_ccur` | sum |
| `reserves_withheld_ccur` | sum |

## Filters

- `periodid_filter`

## Derived Table

```sql
sql:
SELECT
    ma.category_id,
    ma.apply_to_period_id,
    ma.parent_id,
    c.iso_4217_code as payout_currency_code,
    sum(ma.amount) as usd_adjustment,
    sum(ma.amount/cr.exchange_rate) as payout_currency_adjustment
FROM
    ROYALTY_ACCOUNTING.PROD.VW_ABACUS_MANUAL_ADJUSTMENT ma
LEFT JOIN
    ROYALTY_ACCOUNTING_REPORTING.PROD.VW_DIM_ABACUS_AR_BOOKED_VENDOR_CONTRACT_SNAPSHOT vcc ON ma.parent_id=vcc.vendor_id
    AND ma.apply_to_period_id=vcc.period_id
LEFT JOIN
    orchard_app_reporting_v2.art_relations_prod_art_relations.currency_exchange_rates cr ON cr.currency_from_id=vcc.currency_id
    AND cr.currency_to_id = 1
    AND cr.period_id = ma.apply_to_period_id
LEFT JOIN
    orchard_app_reporting_v2.art_relations_prod_art_relations.currencies c ON c.id=cr.currency_from_id
WHERE 1
    AND ma.parent_type = 'vendor'
    AND ma.category_id = 68
    AND {% condition periodid_filter %
```

