view: royalty_prod_accounting_run_results_distro { sql_table_name: ROYALTY_ACCOUNTING.PROD.ACCOUNTING_RUN_RESULTS_DISTRO ;; dimension: contract_txn_id { sql: ${TABLE}.CONTRACT_TXN_ID ;; type: number description: "Unique identifier of a contract_transaction (CONTRACT_TRANSACTION_STAGING.CONTRACT_TXN_ID)." } dimension: txn_id { sql: ${TABLE}.TXN_ID ;; type: number description: "Unique identifier of a transaction (STMT_DB_SALES_DISTRO_STAGING.STMT_DB_SALES_DISTRO_TXN_ID)." } dimension: accounting_run_id { sql: ${TABLE}.ACCOUNTING_RUN_ID ;; type: number description: "ID of the accounting_run these results belong to (royalty_accounting.accounting_run.accounting_run_id)." } dimension: accounting_run_name { sql: ${TABLE}.ACCOUNTING_RUN_NAME ;; type: string description: "Name of the accounting_run these results belong to (royalty_accounting.run_controller.run_controller_name)." } dimension: term_rate { sql: ${TABLE}.TERM_RATE ;; type: number value_format: "0.0000" description: "The term rate on the contract applied to royalties (contract_term_condition.term_rate / 100)." } measure: unit_price_sale_currency { sql: ${TABLE}.UNIT_PRICE_SALE_CURRENCY ;; type: sum description: "Sale unit price converted from USD to sale currency (UNIT_PRICE_USD / ACTIVITY_RATE_USD)." } measure: gross_revenue_sale_currency { sql: ${TABLE}.GROSS_REVENUE_SALE_CURRENCY ;; type: sum description: "Gross revenue of sales in the original sale currency (QUANTITY * UNIT_PRICE_SALE_CURRENCY)." } measure: withholding_tax_sale_currency { sql: ${TABLE}.WITHHOLDING_TAX_SALE_CURRENCY ;; type: sum description: "Withholding tax converted from USD to sale currency (WITHHOLDING_TAX_USD / ACTIVITY_RATE_USD)." } measure: gross_revenue_after_wh_tax_sale_currency { sql: ${TABLE}.GROSS_REVENUE_AFTER_WITHHOLDING_TAX_SALE_CURRENCY ;; type: sum description: "Gross revenue of sales minus WHT in sale currency (GROSS_REVENUE_SALE_CURRENCY - WITHHOLDING_TAX_SALE_CURRENCY)." } measure: net_revenue_sale_currency { sql: ${TABLE}.NET_REVENUE_SALE_CURRENCY ;; type: sum description: "Gross revenue after applying contract term rate (GROSS_REVENUE_AFTER_WHT_SALE_CURRENCY * TERM_RATE)." } measure: distribution_fee_sale_currency { sql: ${TABLE}.DISTRIBUTION_FEE_SALE_CURRENCY ;; type: sum description: "Distribution fee in sale currency (GROSS_REVENUE_AFTER_WHT_SALE_CURRENCY - NET_REVENUE_SALE_CURRENCY * -1)." } measure: unit_price_payee_currency { sql: ${TABLE}.UNIT_PRICE_PAYEE_CURRENCY ;; type: sum description: "Sale unit price converted to the account preferred currency (UNIT_PRICE_SALE_CURRENCY * exchange_rate.rate)." } measure: gross_revenue_payee_currency { sql: ${TABLE}.GROSS_REVENUE_PAYEE_CURRENCY ;; type: sum description: "Gross revenue converted to account preferred currency (GROSS_REVENUE_SALE_CURRENCY * exchange_rate.rate)." } measure: withholding_tax_payee_currency { sql: ${TABLE}.WITHHOLDING_TAX_PAYEE_CURRENCY ;; type: sum description: "Withholding tax converted to account preferred currency (WITHHOLDING_TAX_SALE_CURRENCY * exchange_rate.rate)." } measure: gross_revenue_after_wh_tax_payee_currency { sql: ${TABLE}.GROSS_REVENUE_AFTER_WITHHOLDING_TAX_PAYEE_CURRENCY ;; type: sum description: "Gross revenue minus WHT converted to account preferred currency (GROSS_REVENUE_AFTER_WHT_SALE_CURRENCY * exchange_rate.rate)." } measure: net_revenue_payee_currency { sql: ${TABLE}.NET_REVENUE_PAYEE_CURRENCY ;; type: sum description: "Net revenue converted to account preferred currency (NET_REVENUE_SALE_CURRENCY * exchange_rate.rate)." } measure: distribution_fee_payee_currency { sql: ${TABLE}.DISTRIBUTION_FEE_PAYEE_CURRENCY ;; type: sum description: "Distribution fee converted to account preferred currency (DISTRIBUTION_FEE_SALE_CURRENCY * exchange_rate.rate)." } }