Forum Discussion

newgirl's avatar
newgirl
Post Patron
4 years ago
Solved

Lookup using Start Date

Hello! I have my main table below:

Main Table

Transaction DateVolumeClientProduct
1-Jan-2210Aballpen
1-Jan-2220Bnotebook
10-Jan-2230Bballpen
28-Feb-2240Aballpen
31-Mar-2210Cballpen

 

I need to add a new column for the category of the product based on the transaction date. However, the categorization changes over time. I have this table to capture that information:

Supporting Table

Start DateEnd DateProductCategory
1-Jan-2231-Jan-22ballpenOffice
1-Jan-2231-Jan-22notebookOffice
1-Jan-2231-Jan-22mugPersonal
1-Jan-2231-Jan-22pencilOffice
1-Feb-2231-Dec-22ballpenPersonal
1-Feb-2231-Dec-22notebookOffice
1-Feb-2231-Dec-22mugPersonal
1-Feb-2231-Dec-22pencilOffice

 

 

Here is my expected output:

Transaction DateVolumeClientProductCategory
1-Jan-2210AballpenOffice
1-Jan-2220BnotebookOffice
10-Jan-2230BballpenOffice
28-Feb-2240AballpenPersonal
31-Mar-2210CballpenPersonal

 

I tried the formula below (after I read some of the questions in this forum) but it says "A table of multiple values was supplied where a single value was expected."

 

Column = CALCULATE(VALUES('Supporting'[Category]),FILTER('Supporting','Main Table'[Transaction Date]>='Supporting'[Start Date] && 'Main Table'[Transaction Date] <= 'Supporting'[End Date]))

 

 

 

Hope somebody can help me!

  • newgirl 

    pls try this

    Column = maxx(FILTER('Supporting Table','Main Table'[Transaction Date]>='Supporting Table'[Start Date]&&'Main Table'[Transaction Date]<='Supporting Table'[End Date]&&'Main Table'[Product]='Supporting Table'[Product]),'Supporting Table'[Category])

3 Replies

  • newgirl 

    pls try this

    Column = maxx(FILTER('Supporting Table','Main Table'[Transaction Date]>='Supporting Table'[Start Date]&&'Main Table'[Transaction Date]<='Supporting Table'[End Date]&&'Main Table'[Product]='Supporting Table'[Product]),'Supporting Table'[Category])