Repository navigation
Feature: Exchange rate addition #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f381ec1
e856a6f
d1e4da9
eb648eb
b3670e4
e7a5c69
805087b
83b3835
0f3e8d4
62f0003
1fd4331
366518d
2eeeb8e
7ddb487
196bc9a
fdf4354
07b4b89
cfe62f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,7 +71,7 @@ Include the following QuickBooks package version in your `packages.yml` file. | |
| ```yaml | ||
| packages: | ||
| - package: fivetran/quickbooks | ||
| version: [">=1.9.0", "<1.10.0"] # we recommend using ranges to capture non-breaking changes automatically | ||
| version: [">=1.10.0", "<1.11.0"] # we recommend using ranges to capture non-breaking changes automatically | ||
| ``` | ||
|
|
||
| > All required sources and staging models are now bundled into this transformation package. Do not include `fivetran/quickbooks_source` in your `packages.yml` since this package has been deprecated. | ||
|
|
@@ -125,6 +125,7 @@ vars: | |
| using_department: false # disable if you don't have departments in QuickBooks | ||
| using_deposit: false # disable if you don't have deposits in QuickBooks | ||
| using_estimate: false # disable if you don't have estimates in QuickBooks | ||
| using_exchange_rate: false # disable if you don't have exchange rates in QuickBooks | ||
| using_invoice: false # disable if you don't have invoices in QuickBooks | ||
| using_invoice_bundle: false # disable if you don't have invoice bundles in QuickBooks | ||
| using_journal_entry: false # disable if you don't have journal entries in QuickBooks | ||
|
|
@@ -223,6 +224,26 @@ vars: | |
| quickbooks__exchange_gain_loss_enabled: true | ||
| ``` | ||
|
|
||
| #### Enabling Report-Date Balance Sheet FX Conversion | ||
|
|
||
| By default, balance sheet accounts held in a foreign currency are converted by summing each underlying transaction's own transaction-date exchange rate. QuickBooks Online instead revalues the account's cumulative native-currency balance using the exchange rate as of the report date, which can produce different converted balances for point-in-time accounts (Bank, Accounts Receivable, Accounts Payable, Credit Card, Equity, Fixed Asset, etc.). | ||
|
|
||
| Enable this feature if you want `converted_amount` on balance sheet accounts to match QuickBooks Online's own report-date revaluation approach. This does not affect profit and loss accounts, since period activity is already correctly valued at the transaction date. | ||
|
|
||
| **This feature requires `quickbooks__home_currency` to also be set** (see [Configuring Your Home Currency for Multicurrency Support](#configuring-your-home-currency-for-multicurrency-support) above) **and the `EXCHANGE_RATE` source table to be synced** (`using_exchange_rate` enabled). The exchange rate lookup matches on your home currency as the conversion target, so without it the lookup never finds a matching rate and every account silently falls back to the legacy method. | ||
|
fivetran-jamie marked this conversation as resolved.
|
||
|
|
||
| To enable, add the following variables to your `dbt_project.yml`: | ||
|
|
||
| ```yml | ||
| vars: | ||
| using_report_date_fx_conversion: true | ||
| quickbooks__home_currency: "USD" # replace with your home currency code | ||
| ``` | ||
|
|
||
| If a matching exchange rate isn't available for an account's currency as of the period's last day, the package falls back to the legacy transaction-date summation method for that account and period. | ||
|
|
||
| > IMPORTANT: If you enable `using_report_date_fx_conversion`, you need to run a `--full-refresh` for the change to take effect on historical data. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If users need to run a full refresh to get the conversion on historical data, we should call this out in the changelog.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added it to the schema change section |
||
|
|
||
| #### Customize the Cash Flow Model | ||
| **IMPORTANT**: It is very likely you will need to reconfigure your `cash_flow_type` to make sure your cash flow statement matches your specific use case. Please examine the following instructions. | ||
|
|
||
|
|
||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| as_of_date,source_currency_code,target_currency_code,rate,created_at,updated_at,_fivetran_deleted | ||
| 2020-01-30,CAD,USD,0.745,2020-01-30 20:00:00,2020-01-30 20:00:00,FALSE | ||
| 2020-02-27,CAD,USD,0.77,2020-02-27 20:00:00,2020-02-27 20:00:00,FALSE | ||
| 2020-03-30,CAD,USD,0.75,2020-03-30 20:00:00,2020-03-30 20:00:00,FALSE | ||
| 2020-04-30,CAD,USD,0.80,2020-04-30 20:00:00,2020-04-30 20:00:00,FALSE | ||
| 2020-05-31,CAD,USD,0.78,2020-05-31 20:00:00,2020-05-31 20:00:00,FALSE | ||
| 2026-01-30,EUR,USD,1.08,2026-01-30 20:00:00,2026-01-30 20:00:00,FALSE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| id,_fivetran_deleted,_fivetran_synced,amount,created_at,from_account_id,private_note,sync_token,to_account_id,currency_id,exchange_rate,transaction_date,updated_at | ||
| 72,FALSE,2020-07-22 19:17:01,31030,2020-07-22 19:06:55,54,caa9e319eab97752f883584868007db3,0,39,USD,,2020-07-23,2020-07-22 19:06:55 | ||
| 125,FALSE,2020-10-28 1:36:52,79753,2020-10-28 1:16:11,54,5cde61c2a6fa9ae48a9129690d3e1632,0,39,USD,,2020-10-28,2020-10-28 1:16:11 | ||
| 125,FALSE,2020-10-28 1:36:52,79753,2020-10-28 1:16:11,54,5cde61c2a6fa9ae48a9129690d3e1632,0,39,USD,,2020-10-28,2020-10-28 1:16:11 | ||
| 90101,FALSE,2020-01-15 12:00:00,1000,2020-01-15 12:00:00,39,rbc_cad_transfer_1,0,94001,CAD,0.74,2020-01-15,2020-01-15 12:00:00 | ||
| 90102,FALSE,2020-02-15 12:00:00,500,2020-02-15 12:00:00,39,rbc_cad_transfer_2,0,94001,CAD,0.76,2020-02-15,2020-02-15 12:00:00 | ||
| 90103,FALSE,2020-03-15 12:00:00,300,2020-03-15 12:00:00,39,rbc_cad_transfer_3,0,94001,CAD,0.72,2020-03-15,2020-03-15 12:00:00 | ||
| 90104,FALSE,2020-01-20 12:00:00,500,2020-01-20 12:00:00,39,gbp_transfer_fallback,0,94002,GBP,0.79,2020-01-20,2020-01-20 12:00:00 | ||
| 90105,FALSE,2020-01-25 12:00:00,600,2020-01-25 12:00:00,39,cad_expense_pnl_check,0,94003,CAD,0.75,2020-01-25,2020-01-25 12:00:00 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| {% macro get_report_date_fx_enabled() %} | ||
|
|
||
| {% set requested = var('using_report_date_fx_conversion', false) and var('using_exchange_rate', true) %} | ||
| {% set home_currency = var('quickbooks__home_currency', '') %} | ||
|
|
||
| {% if requested and home_currency == '' %} | ||
| {{ log("\n\nWARNING: `using_report_date_fx_conversion` is enabled but `quickbooks__home_currency` is not set, so report-date FX rates will not be found and the legacy converted balance will be used instead. Set `quickbooks__home_currency` to enable report-date conversion. See the README for setup details.\n", info=True) }} | ||
| {% endif %} | ||
|
|
||
| {{ return(requested) }} | ||
|
|
||
| {% endmacro %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| {% macro get_exchange_rate_columns() %} | ||
|
|
||
| {% set columns = [ | ||
| {"name": "as_of_date", "datatype": "date"}, | ||
| {"name": "source_currency_code", "datatype": dbt.type_string()}, | ||
| {"name": "target_currency_code", "datatype": dbt.type_string()}, | ||
| {"name": "rate", "datatype": dbt.type_float()}, | ||
| {"name": "created_at", "datatype": dbt.type_timestamp()}, | ||
| {"name": "updated_at", "datatype": dbt.type_timestamp()}, | ||
| {"name": "_fivetran_deleted", "datatype": dbt.type_boolean()} | ||
| ] %} | ||
|
|
||
| {{ return(columns) }} | ||
|
|
||
| {% endmacro %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing PR link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added