Forum Discussion
Coffee321
2 years agoFrequent Visitor
Lookup value from another table based on key match and nearest date match
I'm trying to bring a value from another table but there is no relationship because of duplicates. This is the Dim table, the value I'm trying to bring over is on the PerUnit column: ...
- 2 years ago
you can create a column
Column =var _last=maxx(FILTER(Dim,'Dim'[Date]<='Fact'[Date]&&'Fact'[Item]=Dim[Item]),'Dim'[Date])return maxx(FILTER(Dim,'Dim'[Item]='Fact'[Item]&&'Dim'[Date]=_last),Dim[PerUnit])or create a measureMeasure =var _last=maxx(FILTER(all(Dim),'Dim'[Date]<=max('Fact'[Date])&&Dim[Item]=max('Fact'[Item])),'Dim'[Date])return maxx(FILTER(all(Dim),Dim[Item]=max('Fact'[Item])&&'Dim'[Date]=_last),'Dim'[PerUnit])pls see the attachment below
ryan_mayu
Super User
2 years agoyou can create a column
Column =
var _last=maxx(FILTER(Dim,'Dim'[Date]<='Fact'[Date]&&'Fact'[Item]=Dim[Item]),'Dim'[Date])
return maxx(FILTER(Dim,'Dim'[Item]='Fact'[Item]&&'Dim'[Date]=_last),Dim[PerUnit])
or create a measure
Measure =
var _last=maxx(FILTER(all(Dim),'Dim'[Date]<=max('Fact'[Date])&&Dim[Item]=max('Fact'[Item])),'Dim'[Date])
return maxx(FILTER(all(Dim),Dim[Item]=max('Fact'[Item])&&'Dim'[Date]=_last),'Dim'[PerUnit])
pls see the attachment below