Link to home
Start Free TrialLog in
Avatar of lankapala
lankapala

asked on

Fact Table Invoice Header and Line

Hi, I have Frieght chargers in the FactInvoiceHeader Table.
But I think better insert Freight Chargers in the FactInvoceLine Table.
Just wondering how do that.
Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)
Flag of United States of America image

Are the freight charges by line item?  If not, they belong in the header table.

Remember, the fields for records in a data warehouse table should all be AT THE SAME LEVEL OF DETAIL.  Putting an invoice level charge in the line item table would break that rule.
Avatar of Kent Olsen
Hi lankapala,

There's nothing wrong with keeping the freight charges in the InvoiceHeader table or in the InvoiceLine table.  Personally, I'd put a row in the InvoiceLine table as it allows more flexibility.  A couple of advantages are that if there are multiple freight charges (i.e., multiple carriers) you'd need to sum them to a single value or keep multiple InvoiceHeader records to record and show each freight charge.  (Yuck.)

Do you have a dimension table that identifies the "row type" in the InvoiceLine table?  If so, add a value for "Freight" and then load populate the correct items to show the freight charges.  If not, you'll have to create one.


Kent
Avatar of lankapala
lankapala

ASKER

Thanks
@Kent Olsen : I have 2 Fact Tables ,FactInvoiceheader and FactInvoiceLine.
so you mean to add extra line to FactInvoiceLine?

Do you have a dimension table that identifies the "row type" in the InvoiceLine table?
Not understand,Can you explain more.

As i understand is No, FactInvoiceLine  is connect with FactInvoiceheader fields are [Invoice Number],[Invoice Sequence]
A data warehouse should have a set of tables associated with each fact table that store some attribute(s) of the fact table.  A dimension table on TIME is very common and facilitates searches delimited by dates.  Assuming that the entire invoice has the same date, a TIME dimension would be applied to the Header table.

The InvoiceItem fact table may need to identify and/or manage multiple entry types.  A data row probably has a unit price, unit count, and extended price for purchased item(s).  If, instead, the row shows the sales tax charged on the invoice, freight charges, credits applied, or any other non-merchandise entry, there needs to be a way to show that and a dimension table is the most appropriate.
Yes, Date Dimension in the applied with Header Table.
so what i did is ,I already added to the FactInvoiceDetails table  extra line (Line number 0) with freight chargers.
This is correct?
If you've got only 1 freight charge per invoice, that will work.  

But it's not a very good long-term solution as it doesn't allow the flexibility to record multiple freight charges, returns, sales tax, excise taxes, etc.  As your database matures you'll probably want to manage more non-merchandise data than a single freight charge.
Thanks , so what your recommend for this?
Thanks , so what your recommend for this? and if you can give me a example, more appreciate. Thx
ASKER CERTIFIED SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks