Lookup based on two criteria including data range - Power Pivot

AliBb

New Member
Joined
Apr 28, 2018
Messages
25
I have two tables

TransactionsTable
InvDate
CustomerName

SalespersonTable
CustomerName
SalesID
SalesPerson
EffectiveFrom

The SalespersonTable has multiple records for the customer - the records are made unique by the SalesID EffectiveFrom columns

Eg

I want to create a column in the TransactionsTable that returns the SalesID and Salesperson from the SalespersonTable based on the CustomerName and the InvDate. The InvDate having to be greater or equal to the EffectiveFrom date. If the customer does not appear in the Salesperson table or there is not a salesperson with an effective from date in relation to the InvDate then UNALLOC should be returned.

Is this possible in PowerPivot?

EG
Results Table (TransactionTable)
InvDate
CustomerName
Amount
SalesID
SalesPerson
01/02/2018
ACME
100.00
RA
Rob Anderson
28/02/2018
ACME
300.00
ST
Ste Trueman
28/12/2017
ACME
500.00
UNALLOC
Unallocated

<tbody style="border-collapse: collapse; width: auto;">
</tbody>








Salesperson Table
CustomerName
SalesID
SalesPerson
EffectiveFrom
ACME
RA
Rob Anderson
01/01/2018
ACME
ST
Ste Trueman
28/02/2018

<tbody style="border-collapse: collapse; width: auto;">
</tbody>






Transaction Table
InvDate
CustomerName
Amount
01/02/2018
ACME
100.00
28/02/2018
ACME
300.00
28/12/2017
ACME
500.00

<tbody style="border-collapse: collapse; width: auto;">
</tbody>
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

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