Skip to content
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

[Bug Fix] Net income adjustment for no revenue/expense lines #149

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# dbt_quickbooks v0.17.1
[PR #149](https://github.com/fivetran/dbt_quickbooks/pull/149) introduces the following updates:

## 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.17.0
[PR #146](https://github.com/fivetran/dbt_quickbooks/pull/146) introduces the following updates:

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.17.0'
version: '0.17.1'

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.

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.17.0'
version: '0.17.1'

profile: 'integration_tests'
config-version: 2
Expand Down
33 changes: 5 additions & 28 deletions models/intermediate/int_quickbooks__retained_earnings.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +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
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 = '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
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