Hi Blake,
thanks for your feedback. My example lacks some other tables because I wanted to focus on the problem of filtering out the currently valid row from "Product Prices".
Your idea of summarizing it up to a "Products" table would help if I could put a filter on the summary and only use rows that are within the current time range, which would be the 2.50$ row for today is between 2022-04-01 and 2022-09-30.
I just checked and there is a filter setting for summary fields. But I guess I'm not able to apply a dynamic date formula there (?)
Another problem I have is that I would need to be able to sell products "in the future". Using the example model again I should have added a "Sales Date" Column to my Order table.
T_ORDER
PRODUCT_ID, PRICE, SALES_DATE
1, 2.50$, 2022-10-01
So if I sell Milk today (2022-09-12) with a future sales date of 2022-10-01, I would need to retrieve the 3.00$ price row which applies for that period.
I think it might be necessary to build a key that somehow contains the different date ranges in "Product Prices" and that can be matched against a key from the Orders table. But since on the Order side I have a single date and in "Product Prices" I have multiple date ranges, I'm not sure how a comparison of those keys could work.
Any further ideas are highly appreciated.
Kind regards,
Martin
------------------------------
Martin Suske
------------------------------