Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Look up value based on date range

Tring to Look up an offer value with in adate range 

 

Table - Offer Table  - values with offers with different date ranges

SupplierProductStartDateEndDateOffer
SUP1PRD11/1/20231/10/2023$5
SUP1PRD11/11/20231/15/2023$6
SUP2PRD21/1/20231/31/2023$10

 

Fact Table - Purchasing Table - With Purchase data 

PODateProductSupplier
10011/4/2023PRD1SUP1
10021/5/2023PRD2SUP2
10031/11/2023PRD1SUP1

 

 

Expected Result - Need to pick the offer price based on the combination of Product & SUpplier for the Date that falls in the date range in Offer table. 

Tried using Lookupvalue, but date range was an issue. How can i use calculated column to solution it. i will need a Calculated column as i have to use a slicer also to identify Offer exist or not. 

PODateProductSupplierOffer
10011/4/2023PRD1SUP1$5
10021/5/2023PRD2SUP2$10
10031/11/2023PRD1SUP1$6

 

Thanks

 

 

 

 

 

 

 

 

 

 

 

 

 

  • Anonymous , A new column fact table

     

    maxx(filter(offfer, offer[Supplier] = fact[Supplier] && offer[product] = fact[product] && Fact[Date] >= offer[Start Date] && Fact[Date] <= offer[End Date] ), offer[offer])

2 Replies

  • Anonymous , A new column fact table

     

    maxx(filter(offfer, offer[Supplier] = fact[Supplier] && offer[product] = fact[product] && Fact[Date] >= offer[Start Date] && Fact[Date] <= offer[End Date] ), offer[offer])