fivetran / dbt_quickbooks

Fivetran data models for QuickBooks using dbt.
https://fivetran.github.io/dbt_quickbooks/
Apache License 2.0
26 stars 38 forks source link

[Bug] Cash Flow statement is not flipping signs appropriately. #133

Open brandonrf94 opened 3 months ago

brandonrf94 commented 3 months ago

Is there an existing issue for this?

Describe the issue

The cash flow statement is looking at the account balances from the balance sheet and not flipping the signs on the appropriate accounts.

For example, an increase in Accounts Receivable month over month would be a negative impact to the Cash Flow statement, however it shows up as a positive impact.

Other accounts such as Accrued Revenue, Prepaid Expenses etc. would also need to be flipped accordingly.

image

Relevant error log or model output

n.a

Expected behavior

Cash Flow statement accounts should have the proper signs to help accurately calculate cash flows.

dbt Project configurations

std.

Package versions

std.

What database are you using dbt with?

snowflake

dbt Version

std.

Additional Context

No response

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

fivetran-joemarkiewicz commented 3 months ago

@brandonrf94 thanks for raising this issue with our team.

Upon taking a look I can confirm that we are not in fact flipping these amounts in the cash flow statement when pulling from the balance sheet.

https://github.com/fivetran/dbt_quickbooks/blob/e604697a51880e2f57bc89606517bb499eb6a017/models/intermediate/int_quickbooks__cash_flow_classifications.sql#L15

Additionally, the example of Accounts Receivable needing to show a negative balance when it increases makes sense to me. I will continue to do some research to understand we have full coverage over which accounts need to be flipped. From your perspective do you know of any other accounts other than the ones listed below need to be flipped?

Once we have identified all the accounts that need to be flipped for the Cash Flow statement, we can likely apply a case when statement here to achieve the desired end result.

brandonrf94 commented 3 months ago

Based on my research (comparing with a customer's Quickbooks cash flow statement)... I had to flip the sign on any account with "account_class = Asset" for Operating & Investing activities.

fivetran-joemarkiewicz commented 3 months ago

Thanks for the quick response here! From a high level viewpoint that logic seems valid to me. I'm going to run this by our internal finance team to confirm there are no other accounts to take into consideration. Once I have confirmation on all accounts that need to be flipped I believe this will be ready to be included in our upcoming sprint.

fivetran-joemarkiewicz commented 2 months ago

Hi @brandonrf94, just posting an update here that I have shared this with our internal finance team and it seems like it depends based on how the B/S is setup that will determine wether you should flip the Assets or the Liabilities/Equity. In the case of this dbt package, switching the sign for Assets should do the trick to generate an accurate report. Additionally, this makes sense given the example you shared earlier.

We will explore adding this sign flip and do some further testing to ensure the accuracy of the logic. We may have more questions for you as we work to integrate this change to ensure we are providing an accurate SoCF report. Thanks again!

fivetran-joemarkiewicz commented 2 months ago

@brandonrf94 after some more exploration and research we will be moving forward with the following logic update to the Statement of Cash Flows with respect to flipping the signs:

If the account_class is "Asset" and the account is not a Cash account then we will flip the signs in the Statement of Cash Flows.

fivetran-joemarkiewicz commented 2 months ago

The last piece of this puzzle is to understand what identifies a "Cash" account. However, I believe this is ready to be accepted. We will add this to the backlog to be integrated in an upcoming release to the QuickBooks dbt package.

Please note, this will not be included in the next release (likely to be on or before this coming Wednesday), but will be included in the following major update.