Effective date lookup

nileshp

New Member
Joined
Oct 29, 2008
Messages
19
In powerpivot, I have a sales register table with item id. And item weight master with following columns
item id, new wgt, effective date.

Every time weight of item changes, new entry is made in this table with effective date. An item weight can change several times. There is no relationship between these tables as item id can repeat in both tables


I want to grab item weight from item weight master in sales register table considering sales invoice date for effective date.

Hope I am clear
Nilesh
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Thanks, but can't use in my scenario.

I should have elaborated the table. SalesReg with relevant columns look like this
InvNo, InvDate, ItemId
I567, 23-07-2016,555
I568, 23-07-2016,589

ItemHistory table with rows relevant to ItemId 555
ItemId , ModifyDate, New wgt
555, 01-04-2015, 2.345
555, 21-07-2015, 2.356
555, 09-04-2016, 2.655
555, 01-09-2016, 2.877

In this example I want to pick 2.655 as that was latest wgt change as on 23-07-2016
If I can use lookup here, please guide me.
 
Upvote 0
Following. I have exactly same scenario. Can't create relationship 'coz of dups and need to get result for latest date.
 
Upvote 0
Hello again,

try

Code:
=CALCULATE(LASTNONBLANK(Table1[New wgt],"") ,FILTER(Table1,Table1[ModifyDate]<=[InvDate]),FILTER(Table1,Table1[ItemId]=[ItemId]))
 
Last edited:
Upvote 0
Following. I have exactly same scenario. Can't create relationship 'coz of dups and need to get result for latest date.

for your case also

Code:
=CALCULATE(max(Table1[ModifyDate]) ,FILTER(Table1,Table1[ModifyDate]<=[InvDate]),FILTER(Table1,Table1[ItemId]=[ItemId]))
 
Upvote 0
Thank you for both options. It is definitely better solution then I had in mind. Seems I over complicated everything :/
Is there perhaps a way to lookup the weight which has modify date closest to invdate.
I tried with beetweendates but with little success.
 
Upvote 0
Thank you for both options. It is definitely better solution then I had in mind. Seems I over complicated everything :/
Is there perhaps a way to lookup the weight which has modify date closest to invdate.
I tried with beetweendates but with little success.

my previous suggestion should work in your case. What is your aim using of DATESBETWEEN()? get sum, count or smth. of given period?

(P.S it'll better to use table names with column names. It'll work correctly)
 
Upvote 0
Hello again,

try

Code:
=CALCULATE(LASTNONBLANK(Table1[New wgt],"") ,FILTER(Table1,Table1[ModifyDate]<=[InvDate]),FILTER(Table1,Table1[ItemId]=[ItemId]))


Thanks again,

But this is returning the highest weight in the new wgt column without considering any filters. updated weight need not be higher than previous. I am trying to tweak your formula but so far no success
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,843
Members
449,471
Latest member
lachbee

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