# View: dt_orca_a_and_lp_timeseries_info

**View Name:** dt_orca_a_and_lp_timeseries_info
**Table Source:** `intelligence.dbt_prod.orca_a_and_lp_timeseries_info`
**File Path:** `views/orca_a_and_lp/dt_orca_a_and_lp_timeseries_info.view.lkml`

## Overview

- **File Size:** 4195 bytes
- **Lines of Code:** 118
- **Dimensions:** 4
- **Measures:** 2
- **Dimension Groups:** 1
- **Filters:** 0

## Comments & Notes

- derived_table: {
- WITH royalty_accounting_prod_vw_dim_abacus_account AS
- dc.countryname

## Dimensions

| Name | Type |
|------|------|
| `vendor_id` | number |
| `royalty_type` | string |
| `gross_rev_usd` | number |
| `distribution_fee_usd` | number |

## Measures

| Name | Type |
|------|------|
| `gross_rev_usd_sum` | sum |
| `distribution_fee_usd_sum` | sum |

## Dimension Groups

| Name | Type |
|------|------|
| `transaction_date` | time |

## SQL Comments

- DATE_TRUNC('month', DATE_FROM_PARTS(sp.statement_year, sp.statement_month, '01')  ) AS statement_month,
- LEFT JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.STATEMENT_PERIOD  AS sp ON fs.statement_period_id = sp.statement_period_id
- LEFT JOIN ORCHARD_APP_REPORTING_V2.ART_RELATIONS_PROD_ART_RELATIONS.VENDOR_CLOSERS  AS vc ON royalty_accounting_prod_vw_dim_abacus_account.account_id = vc.vendor_id
- LEFT JOIN orchard_app_reporting_v2.art_relations_prod_art_relations.orchadmin_users  AS closer ON vc.orchadmin_user_id = closer.id
- ((( DATE_FROM_PARTS(sp.statement_year, sp.statement_month, '01')   ) >= ((DATEADD('month', -14, DATE_TRUNC('month', CURRENT_DATE())))) AND ( DATE_FROM_PARTS(sp.statement_year, sp.statement_month, '01')   ) < ((DATEADD('month', 15, DATEADD('month', -14, DATE_TRUNC('month', CURRENT_DATE())))))))

## Derived Table

```sql
#    sql:
#      WITH royalty_accounting_prod_vw_dim_abacus_account AS
#(select
#    aa.*,
#    dc.countryname
#    from ROYALTY_ACCOUNTING.PROD.VW_DIM_ABACUS_ACCOUNT aa
#    left join facts.prod.dim_country dc on dc.ISO3166A3 = aa.country_of_tax_residence
#    )
#SELECT
#    fs.account_id as vendor_id,
#    fs.transaction_date as transaction_date,
#    --DATE_TRUNC('month', DATE_FROM_PARTS(sp.statement_year, sp.statement_month, '01')  ) AS statement_month,
#    COALESCE(SUM(case
#      when fs.sale_currency_code = 'USD' then fs.gross_revenue_sale_currency
#      when fs.sale_currency_code != 'USD' and  er.to_currency_code  = 'USD' then fs.gross_revenue_sale_currency *  er.rate
#    else 0
#    end), 0) AS gross_revenue_usd,
#    COALESCE(SUM(case
#      when fs.sale_currency_code = 'USD' then fs.distribution_fee_sale_currency
#      when fs.sale_currency_code != 'USD' and  er.to_currency_code  = 'USD' then fs.distribution_fee_sale_currency *  er.rate
#    else 0
#    end), 0) AS distribution_fee_usd
#FROM royalty_accounting.prod.abacus_fact_sales_unified_dbt  AS fs
#--LEFT JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.STATEMENT_PERIOD  AS sp ON fs.statement_period_id = sp.statement_period_id
#LEFT JOIN royalty_accounting_prod_vw_dim_abacus_account ON fs.account_id= royalty_accounting_prod_vw_dim_abacus_account.account_id
#LEFT JOIN ORCHARD_APP_REPORTING_V2.PROD_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.EXCHANGE_RATE AS er ON fs.statement_period_id= er.statement_period_id and
#          fs.sale_currency_code=er.from_currency_code
#          and er.to_currency_code = 'USD'
#--LEFT JOIN ORCHARD_APP_REPORTING_V2.ART_RELATIONS_PROD_ART_RELATIONS.VENDOR_CLOSERS  AS vc ON royalty_accounting_prod_vw_dim_abacus_account.account_id = vc.vendor_id
#--LEFT JOIN orchard_app_reporting_v2.art_relations_prod_art_relations.orchadmin_users  AS closer ON vc.orchadmin_user_id = closer.id
#WHERE
#
#--((( DATE_FROM_PARTS(sp.statement_year, sp.statement_month, '01')   ) >= ((DATEADD('month', -14, DATE_TRUNC('month', CURRENT_DATE())))) AND ( DATE_FROM_PARTS(sp.statement_year, sp.statement_month, '01')   ) < ((DATEADD('month', 15, DATEADD('month', -14, DATE_TRUNC('month', CURRENT_DATE())))))))
#--AND ((UPPER(( closer.f_name||' '||closer.l_name  )) LIKE UPPER('%Richard Pattison%')))
#
#fs.transaction_date >= current_date()-1095
#
#GROUP BY
#    all
#ORDER BY
#    1, 2 desc
#
#    ;;
#
```

