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 1 commit
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
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.1-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.17.0
[PR #146](https://github.com/fivetran/dbt_quickbooks/pull/146) 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.17.0", "<0.18.0"] # we recommend using ranges to capture non-breaking changes automatically
version: 0.17.1-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
6 changes: 1 addition & 5 deletions docs/catalog.json

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions docs/manifest.json

Large diffs are not rendered by default.

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