Connecting Invoices and credit notes tables from Xero
I'm building a model using Xero data. The objective is to be able to show sales income by sales person or product over time.
Currently I can link sales person to Invoice by Invoice number and show over time using the invoice date., the invoices are broken down by product and line item prices.
The issue is connecting credit notes. This table is very similar to the invoice table. All credit notes should be linked to an invoice by reference e.g. INV-1234 relates to CN-1234 (99% of the time).
Credit notes will either be for the full amount of the invoice or partial amount and like invoice are broken down by product line item. Sometimes these credit notes will be issued after the invoice but this is not so relevant.
I was hoping someone has some experience of this and can suggest the best way to link the data? Should this be by combining the tables into a single fact table or as a calculated measure?