Calculate field combining two 2 fields? Cost by month

AlexVieira

New Member
Joined
Nov 23, 2016
Messages
1
Hello there!

I've been knocking my head in the wall over this one and i'm stucked :LOL:

Here is the deal:
Have a data model with two tables:
A sales table with the "primary key" being the Item reference.
Another table with the product cost. The thing is it has the prices by month.

I'm looking to create a calculated field in the data model that relates the sales table with the product cost within the correct month.

I've tried to assemble the product cost in two ways:
One with three columns (Reference | Cost | Date) - Here the rows have the reference repeated for each month
Other with (Reference | Jan 2016 | Feb 2016 | etc |etc ) - Here no repetitions of the reference but the date is is the column header.

Any thoughts?

Thanks in advance!!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
A few thoughts from me. You say your sales table has a primary key - that is unlikely unless it is an invoice header table and the primary key is the invoice number. Is this instead a foreign key to a product? Assuming so, I would create a product table with a primary key being the product number. Link the sales table to this one. Then create a calendar table and link that to the sales table too. The price table should be as you suggest in your option 1, definitely not option 2. If your table has 1 price record per month per product, you should be good to go as long as your sales table is also monthly. Just join the price table to the product table and the calendar table. If the sale table is daily then you will need to do something a bit different, as it won't work to connect the monthly prices to the calendar day table. You would instead not join the price table to the calendar table, and need to write a more complex dax formula to filter the price table based on the selection in he calendar table. If you can post a sample as I describe, I can help you out.
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,706
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top