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

Cash flow statement drops cash_beginning_value and the cash_net_period for the first row of a particular account #88

Closed
2 of 4 tasks
caffeinebounce opened this issue Apr 23, 2023 · 2 comments
Assignees
Labels
status:in_review Currently in review update_type:models Primary focus requires model updates

Comments

@caffeinebounce
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

The final CTE for quickbooks__cash_flow_statement should coalesce 0 with lag(cash_ending_period) since the value for the first row will always be null.

Corrected code:

final as (

select cash_flow_classifications.*,
    coalesce(lag(cash_ending_period) over (partition by account_id, class_id, source_relation order by cash_flow_period), 0) as cash_beginning_period,
    cash_ending_period - coalesce(lag(cash_ending_period) over (partition by account_id, class_id, source_relation order by cash_flow_period), 0) as cash_net_period
from cash_flow_classifications

)

Relevant error log or model output

No response

Expected behavior

Every row should have a value, even if 0

dbt Project configurations

/

Package versions

/

What database are you using dbt with?

snowflake

dbt Version

1.4.1

Additional Context

No response

Are you willing to open a PR to help address this issue?

  • Yes.
  • Yes, but I will need assistance and will schedule time during our office hours for guidance
  • No.
@caffeinebounce caffeinebounce added the bug Something isn't working label Apr 23, 2023
@fivetran-joemarkiewicz
Copy link
Contributor

Hi @caffeinebounce thanks for raising this and I agree with you that a coalesce to 0 would be ideal here! We are actually planning to include some changes to the QuickBooks package in the next few days and I think this would be a great fix to include.

I noticed you are open to contributing. If you would like, you can open a PR with this fix and I will integrate it into the next wave of changes.

@fivetran-joemarkiewicz fivetran-joemarkiewicz added status:accepted Scoped and accepted into queue update_type:models Primary focus requires model updates and removed bug Something isn't working labels Apr 24, 2023
@fivetran-joemarkiewicz fivetran-joemarkiewicz added status:in_review Currently in review and removed status:accepted Scoped and accepted into queue labels Apr 27, 2023
@fivetran-joemarkiewicz
Copy link
Contributor

Thanks again for helping with this @caffeinebounce! This is now live in the latest version of the package!

Closing this issue, please feel free to reopen if the issue still persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:in_review Currently in review update_type:models Primary focus requires model updates
Projects
None yet
Development

No branches or pull requests

2 participants