Skip to content

Commit

Permalink
Merge pull request #147 from fivetran/bugfix/net-income-adjustment-fo…
Browse files Browse the repository at this point in the history
…r-no-revenue-expense-lines

[Pre-release] Bug fix for net income adjustment for no revenue/expense lines
  • Loading branch information
fivetran-avinash authored Nov 21, 2024
2 parents ea05fe5 + 79f7ef1 commit c0ca2ea
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 39 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# dbt_quickbooks v0.17.0-a1

## Bug Fix
- Updated the logic in `int_quickbooks__retained_earnings` to ensure accounting periods with no revenue and expense class lines were accounted for.
- This will ensure the net income adjustment is available regardless of existing revenue or expenses.

# dbt_quickbooks v0.16.0
[PR #143](https://github.com/fivetran/dbt_quickbooks/pull/143) introduces the following updates:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Include the following QuickBooks package version in your `packages.yml` file.
```yaml
packages:
- package: fivetran/quickbooks
version: [">=0.16.0", "<0.17.0"] # we recommend using ranges to capture non-breaking changes automatically
version: 0.17.0-a1 # we recommend using ranges to capture non-breaking changes automatically
```
Do NOT include the `quickbooks_source` package in this file. The transformation package itself has a dependency on it and will install the source package as well.
Expand Down
2 changes: 1 addition & 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: '0.16.0'
version: '0.17.0'

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

Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

37 changes: 32 additions & 5 deletions docs/index.html

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'quickbooks_integration_tests'

version: '0.16.0'
version: '0.17.0'

profile: 'integration_tests'
config-version: 2
Expand Down
34 changes: 5 additions & 29 deletions models/intermediate/int_quickbooks__retained_earnings.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,19 @@ with general_ledger_balances as (
from {{ ref('int_quickbooks__general_ledger_balances') }}
),

revenue_starter as (
net_income_loss as (

select
period_first_day,
source_relation,
sum(period_net_change) as revenue_net_change,
sum(period_net_converted_change) as revenue_net_converted_change
from general_ledger_balances

where account_class = 'Revenue'

{{ dbt_utils.group_by(2) }}
),

expense_starter as (

select
period_first_day,
source_relation,
sum(period_net_change) as expense_net_change,
sum(period_net_converted_change) as expense_net_converted_change
sum(case when account_class = 'Revenue' then period_net_change else 0 end) as revenue_net_change,
sum(case when account_class = 'Revenue' then period_net_converted_change else 0 end) as revenue_net_converted_change,
sum(case when account_class = 'Expense' then period_net_change else 0 end) as expense_net_change,
sum(case when account_class = 'Expense' then period_net_converted_change else 0 end) as expense_net_converted_change
from general_ledger_balances

where account_class = 'Expense'

{{ dbt_utils.group_by(2) }}
),

net_income_loss as (

select *
from revenue_starter

join expense_starter
using (period_first_day, source_relation)
),

retained_earnings_starter as (

select
Expand Down

0 comments on commit c0ca2ea

Please sign in to comment.