Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .quickstart/quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ table_variables:
using_estimate:
- estimate
- estimate_line
using_exchange_rate:
- exchange_rate
using_invoice:
- invoice_linked_txn
- invoice_line
Expand Down Expand Up @@ -136,9 +138,15 @@ supported_vars:
quickbooks__home_currency:
type: string
value: ""
description: "The primary reporting currency, use the same 3-letter ISO currency code (e.g., USD, EUR, GBP, CAD) that appears in your QuickBooks `currency_id` field. Relevant for organizations with multiple currencies, this field defaults to an empty string; when not set, the package applies exchange rate conversions to all transactions, regardless of currency."
description: "The primary reporting currency, use the same 3-letter ISO currency code (e.g., USD, EUR, GBP, CAD) that appears in your QuickBooks `currency_id` field. Relevant for organizations with multiple currencies, this field defaults to an empty string; when not set, the package applies exchange rate conversions to all transactions, regardless of currency. Required if 'Enable Report-Date Balance Sheet FX Conversion' is true."
display_name: "Home Currency"

using_report_date_fx_conversion:
type: boolean
value: false
description: "Enable to revalue foreign-currency balance sheet accounts using the exchange rate as of the report date, matching how QuickBooks Online calculates balance sheet conversions. Requires 'Home Currency' to also be set and the `EXCHANGE_RATE` source table to be synced."
display_name: "Enable Report-Date Balance Sheet FX Conversion"

quickbooks__exchange_gain_loss_enabled:
type: boolean
value: false
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# dbt_quickbooks v1.10.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing PR link

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added


[PR #223](https://github.com/fivetran/dbt_quickbooks/pull/223) includes the following updates:

## Schema/Data Change (--full-refresh required if `using_report_date_fx_conversion` is enabled)
**2 total changes • 0 possible breaking changes**

| Data Model(s) | Change type | Old | New | Notes |
| ---------- | ----------- | -------- | -------- | ----- |
| `quickbooks__general_ledger_by_period`, `quickbooks__balance_sheet` | Opt-in calculation change for `converted_amount` fields | Converted balance summed from each transaction's own transaction-date exchange rate | For balance sheet accounts, re-converts the native `period_ending_balance` using the exchange rate as of the period's last day | Opt-in via the new `using_report_date_fx_conversion` variable (default `false`); falls back to the legacy method if disabled or if no matching exchange rate is found. No existing customer is affected unless this variable is enabled. **Requires a `--full-refresh` after enabling this variable for the change to apply to historical data.** |
| `stg_quickbooks__exchange_rate`, `stg_quickbooks__exchange_rate_tmp` | New staging models | | | Brings in the new `EXCHANGE_RATE` source table so historical exchange rates can be looked up by date and currency pair. Consumed by `int_quickbooks__general_ledger_balances` to look up the report-date rate for the opt-in conversion described below. |

## Feature Update
### Report-Date Balance Sheet FX Conversion
- Adds the `using_report_date_fx_conversion` variable (default `false`) to opt into revaluing foreign-currency balance sheet accounts (Bank, AR, AP, Credit Card, Equity, Fixed Asset, etc.) using the exchange rate as of the report date, matching how QuickBooks Online itself calculates balance sheet conversions. Profit and loss accounts are unaffected, since period activity is already valued at the transaction date. See the [README](https://github.com/fivetran/dbt_quickbooks/tree/main#enabling-report-date-balance-sheet-fx-conversion) for configuration details.

# dbt_quickbooks v1.9.2

[PR #220](https://github.com/fivetran/dbt_quickbooks/pull/220) includes the following updates:
Expand Down
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Comment thread
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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.

Expand Down
5 changes: 4 additions & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config-version: 2
name: 'quickbooks'

version: '1.9.2'
version: '1.10.0'

require-dbt-version: [">=1.3.0", "<3.0.0"]

Expand Down Expand Up @@ -47,6 +47,7 @@ vars:
estimate: "{{ source('quickbooks', 'estimate') }}"
estimate_line: "{{ source('quickbooks', 'estimate_line') }}"
estimate_tax_line: "{{ source('quickbooks','estimate_tax_line') }}"
exchange_rate: "{{ source('quickbooks', 'exchange_rate') }}"
invoice_line: "{{ source('quickbooks', 'invoice_line') }}"
invoice_line_bundle: "{{ source('quickbooks', 'invoice_line_bundle') }}"
invoice_linked_txn: "{{ source('quickbooks', 'invoice_linked_txn') }}"
Expand Down Expand Up @@ -97,6 +98,7 @@ vars:
using_sales_receipt: true
using_credit_card_payment_txn: false
using_purchase_order: false
using_exchange_rate: true
quickbooks__tax_lines_enabled: false
using_invoice_tax_line: false
using_journal_entry_tax_line: false
Expand All @@ -110,6 +112,7 @@ vars:
using_tax_agency: false
using_tax_rate: false
quickbooks__exchange_gain_loss_enabled: false
using_report_date_fx_conversion: false

analysis-paths: ["analysis"]
clean-targets:
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions integration_tests/ci/test_scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ test_scenarios:
quickbooks__exchange_gain_loss_enabled: true
include_incremental: false

- name: "Exchange Rate disabled"
vars:
using_exchange_rate: false
include_incremental: false

- name: "Report-Date FX Conversion enabled"
vars:
using_report_date_fx_conversion: true
quickbooks__home_currency: "USD"
include_incremental: false

- name: "Tax Lines enabled"
vars:
quickbooks__tax_lines_enabled: true
Expand Down
8 changes: 7 additions & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'quickbooks_integration_tests'
version: '1.9.2'
version: '1.10.0'

profile: 'integration_tests'
config-version: 2
Expand Down Expand Up @@ -31,6 +31,7 @@ vars:
quickbooks_deposit_identifier: "deposit_data"
quickbooks_estimate_identifier: "estimate_data"
quickbooks_estimate_line_identifier: "estimate_line_data"
quickbooks_exchange_rate_identifier: "exchange_rate_data"
quickbooks_invoice_identifier: "invoice_data"
quickbooks_invoice_line_identifier: "invoice_line_data"
quickbooks_invoice_line_bundle_identifier: "invoice_line_bundle_data"
Expand Down Expand Up @@ -81,6 +82,7 @@ vars:
# using_estimate_tax_line: true # @docs-include
# using_tax_agency: true # @docs-include
# using_tax_rate: true # @docs-include
# using_report_date_fx_conversion: true # @docs-include

seeds:
+docs:
Expand Down Expand Up @@ -133,6 +135,10 @@ seeds:
estimate_line_data:
+column_types:
amount: "{{ 'FLOAT64' if target.type == 'bigquery' else 'float' }}"
exchange_rate_data:
+column_types:
as_of_date: date
rate: "{{ 'FLOAT64' if target.type == 'bigquery' else 'float' }}"
invoice_data:
+column_types:
due_date: date
Expand Down
5 changes: 4 additions & 1 deletion integration_tests/seeds/account_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ id,_fivetran_synced,account_number,account_sub_type,account_type,active,balance,
92002,2026-02-01 12:00:00,9202,AccountsReceivable,Accounts Receivable,TRUE,0,0,Asset,2026-01-15 00:00:00,EUR,EUR accounts receivable account,Accounts Receivable EUR,Accounts Receivable EUR,,FALSE,1,,2026-01-15 00:00:00,FALSE
93001,2026-01-15 00:00:00,9301,ExchangeGainOrLoss,Other Income,TRUE,0,0,Revenue,2026-01-15 00:00:00,USD,Exchange gain or loss account,Exchange Gain or Loss,Exchange Gain or Loss,,FALSE,1,,2026-01-15 00:00:00,FALSE
93002,2026-01-15 00:00:00,9302,AccountsPayable,Accounts Payable,TRUE,0,0,Liability,2026-01-15 00:00:00,EUR,EUR accounts payable account,Accounts Payable EUR,Accounts Payable EUR,,FALSE,1,,2026-01-15 00:00:00,FALSE
94001,2020-02-01 12:00:00,9401,195917574edc9b6bbeb5be9785b6a479,Bank,TRUE,1800,1800,Asset,2020-01-01 00:00:00,CAD,RBC CAD checking account used to validate report-date FX conversion,RBC CAD Checking,RBC CAD Checking,,FALSE,1,,2020-01-01 00:00:00,FALSE
94002,2020-02-01 12:00:00,9402,195917574edc9b6bbeb5be9785b6a479,Bank,TRUE,500,500,Asset,2020-01-01 00:00:00,GBP,GBP checking account with no matching exchange rate to validate fallback,GBP Checking,GBP Checking,,FALSE,1,,2020-01-01 00:00:00,FALSE
94003,2020-02-01 12:00:00,9403,d225490f65343b9016d6db95c0b146d8,Expense,TRUE,600,600,Expense,2020-01-01 00:00:00,CAD,CAD travel expense account to validate P&L accounts are unaffected,CAD Travel Expense,CAD Travel Expense,,FALSE,1,,2020-01-01 00:00:00,FALSE
20299,2026-02-10 12:00:00,2099,100fb8196b919896e083af2939bbffb3,Accounts Payable,TRUE,0,0,Liability,2026-02-10 00:00:00,GBP,Second AP account for fanout test,Misconfigured Loan Payable,Misconfigured Loan Payable,,FALSE,1,,2026-02-10 12:00:00,FALSE
92003,2026-02-10 12:00:00,9203,AccountsReceivable,Accounts Receivable,TRUE,0,0,Asset,2026-02-10 00:00:00,GBP,Second AR account for JE lookup test,Accounts Receivable 2,Accounts Receivable 2,,FALSE,1,,2026-02-10 12:00:00,FALSE
94101,2026-02-10 12:00:00,9401,AccountsReceivable,Accounts Receivable,TRUE,0,0,Asset,2026-02-10 00:00:00,GBP,Alternate GBP AR account to simulate multi-account ambiguity,Accounts Receivable GBP Alt,Accounts Receivable GBP Alt,,FALSE,1,,2026-02-10 12:00:00,FALSE
94102,2026-02-10 12:00:00,9402,100fb8196b919896e083af2939bbffb3,Accounts Payable,TRUE,0,0,Liability,2026-02-10 00:00:00,GBP,Alternate GBP AP account to simulate multi-account ambiguity,Accounts Payable GBP Alt,Accounts Payable GBP Alt,,FALSE,1,,2026-02-10 12:00:00,FALSE
94102,2026-02-10 12:00:00,9402,100fb8196b919896e083af2939bbffb3,Accounts Payable,TRUE,0,0,Liability,2026-02-10 00:00:00,GBP,Alternate GBP AP account to simulate multi-account ambiguity,Accounts Payable GBP Alt,Accounts Payable GBP Alt,,FALSE,1,,2026-02-10 12:00:00,FALSE
7 changes: 7 additions & 0 deletions integration_tests/seeds/exchange_rate_data.csv
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
7 changes: 6 additions & 1 deletion integration_tests/seeds/transfer_data.csv
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
12 changes: 12 additions & 0 deletions macros/get_report_date_fx_enabled.sql
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 %}
15 changes: 15 additions & 0 deletions macros/staging/get_exchange_rate_columns.sql
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 %}
16 changes: 16 additions & 0 deletions models/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,22 @@ Boolean created by Fivetran to indicate whether the record has been deleted.
The number of home currency units it takes to equal one unit of currency specified by `currency_id`.
{% enddocs %}

{% docs exchange_rate_table %}
Table containing historical currency exchange rates used to convert amounts between currencies.
{% enddocs %}

{% docs as_of_date %}
The date the exchange rate was effective as of.
{% enddocs %}

{% docs source_currency_code %}
The currency code being converted from.
{% enddocs %}

{% docs target_currency_code %}
The currency code being converted to.
{% enddocs %}

{% docs tax_rate_id %}
The unique ID of the tax rate applied to this line.
{% enddocs %}
Expand Down
Loading
Loading