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)
[TABLE="class: grid, width: 750, align: left"]
<tbody style="border-collapse: collapse; width: auto;">[TR]
[TD]InvDate
[/TD]
[TD]CustomerName
[/TD]
[TD]Amount
[/TD]
[TD]SalesID
[/TD]
[TD]SalesPerson
[/TD]
[/TR]
[TR]
[TD]01/02/2018
[/TD]
[TD]ACME
[/TD]
[TD]100.00
[/TD]
[TD]RA
[/TD]
[TD]Rob Anderson
[/TD]
[/TR]
[TR]
[TD]28/02/2018
[/TD]
[TD]ACME
[/TD]
[TD]300.00
[/TD]
[TD]ST
[/TD]
[TD]Ste Trueman
[/TD]
[/TR]
[TR]
[TD]28/12/2017
[/TD]
[TD]ACME
[/TD]
[TD]500.00
[/TD]
[TD]UNALLOC
[/TD]
[TD]Unallocated
[/TD]
[/TR]
</tbody>[/TABLE]








Salesperson Table
[TABLE="class: grid, width: 500, align: left"]
<tbody style="border-collapse: collapse; width: auto;">[TR]
[TD]CustomerName
[/TD]
[TD]SalesID
[/TD]
[TD]SalesPerson
[/TD]
[TD]EffectiveFrom
[/TD]
[/TR]
[TR]
[TD]ACME
[/TD]
[TD]RA
[/TD]
[TD]Rob Anderson
[/TD]
[TD]01/01/2018
[/TD]
[/TR]
[TR]
[TD]ACME
[/TD]
[TD]ST
[/TD]
[TD]Ste Trueman
[/TD]
[TD]28/02/2018
[/TD]
[/TR]
</tbody>[/TABLE]






Transaction Table
[TABLE="class: grid, width: 500, align: left"]
<tbody style="border-collapse: collapse; width: auto;">[TR]
[TD]InvDate
[/TD]
[TD]CustomerName
[/TD]
[TD]Amount
[/TD]
[/TR]
[TR]
[TD]01/02/2018
[/TD]
[TD]ACME
[/TD]
[TD]100.00
[/TD]
[/TR]
[TR]
[TD]28/02/2018
[/TD]
[TD]ACME
[/TD]
[TD]300.00
[/TD]
[/TR]
[TR]
[TD]28/12/2017
[/TD]
[TD]ACME
[/TD]
[TD]500.00[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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