Forum Discussion
Elud89
4 years agoFrequent Visitor
Complex Lookupvalue
Hi PowerBI Community, I am trying to join two tables and populate a unique value based on a set of conditions. I would normally use lookupvalue to accomplish this, but there are multiple answers ...
- 4 years ago
Hi Elud89 ,
I would use CALCULATE instead of LOOKUPVALUE for your use case.
Sample formula:
UPLIFT = CALCULATE ( MAX ( Table1[Uplift %] ), FILTER ( ALL ( Table1 ), Table1[Item Code] = EARLIER ( Table2[Item Code] ) && EARLIER ( Table2[Cost] ) >= Table1[Cost From] && EARLIER ( Table2[Cost] ) <= Table1[Cost To] ) )sample result
danextian
4 years agoSuper User
Hi Elud89 ,
I would use CALCULATE instead of LOOKUPVALUE for your use case.
Sample formula:
UPLIFT =
CALCULATE (
MAX ( Table1[Uplift %] ),
FILTER (
ALL ( Table1 ),
Table1[Item Code] = EARLIER ( Table2[Item Code] )
&& EARLIER ( Table2[Cost] ) >= Table1[Cost From]
&& EARLIER ( Table2[Cost] ) <= Table1[Cost To]
)
)
sample result
Elud89
4 years agoFrequent Visitor
Hey! It looks like this worked. I'll have to keep playing around with it, but this is greatly appreciated. Thank you!