Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I'm looking for opinions on the proper way to handle my Cost Table but am struggling with what i'm finding online... I've thought of a few solutions but am looking for suggestions on the optimal path. I've given a quick rundown of options I've thought about but there's a good chance i'm going about this the wrong way, so please feel free to put out other options...
Do any of these look like the right approach? What would you do?
Quick mockup of what the basica data looks like -
Option 1 - Connect on MatRegion Key for a many-many relationship.
Option 2 - In Power Query, Iterate the date ranges in the cost table to give repetitive costs for each product for each day in between the date ranges via ={Number.From([Valid From])..Number.From([Valid To])}.
Option 3 - Same as 2, iterate date ranges in Power Query, but instead of loading to the model create the keys in PQ and merge so that only the needed costs are pulled into the reports.
*** There are some other tables in the model with additional merges but the Cost Table is by far the bulk of the data ***
Hi @MostlySunny ,
It looks as though your Cost table is a Slowly-Changing Dimension (SCD) table i.e. item rows get duplicated based on changing relevant dates, such as 'active from <date>, active to <date>'.
If so, then I'd recommend handling this in DAX. I generally recommend against using calculated columns in DAX but this is the one exception I make - I haven't found a faster or simpler method yet.
--Assumptions--
[Date Approved] sits in your Quote Line table and is a proper date.
[Start Year Month] is a proper date.
[End Year month] is a proper date.
CostTable[Material] and QuoteLine[Material] contain relatable values.
--Process--
Remove the relationship between CostTable and QuoteLine.
Add a new DAX calculated column in your QuoteLine table as follows:
..materialCost =
CALCULATE(
VAR __Material = VALUES(QuoteLine[Material])
VAR __AppDate = VALUES(QuoteLine[Date Approved])
RETURN
MAXX(
FILTER(
costTable,
costTable[Material] = __Material
&& costTable[Start Year Month] <= __AppDate
&& costTable[End Year Month] >= __AppDate
),
costTable[Cost (LC)]
)
)
You should find this to be far more performant than Many:Many relationships and Power Query gymnastics.
Pete
Proud to be a Datanaut!