Forum Discussion
Anonymous
6 years agoNot applicable
LOOKUPVALUE and Filters
Hi, can you help me pls. I can't find anything in this area Еhere are 2 tables without any relationship. I need to put the price from the first table to the second if Shop and Prod_Id matched. Bu...
- 6 years ago
Hi, Anonymous
“LOOKUPVALUE” function is not the right direction here. We can use a measure as below to work on it.
Price = VAR maxdate = CALCULATE ( MAX ( Price[Date(when start work with this price)] ), FILTER ( Price, Price[Shop] = Customer[Shop] && Price[Prod_id] = Customer[Prod_id] && Price[Date(when start work with this price)] < Customer[Date] ) ) RETURN CALCULATE ( MAX ( Price[Price] ), FILTER ( Price, Price[Date(when start work with this price)] = maxdate && Price[Shop] = Customer[Shop] && Price[Prod_id] = Customer[Prod_id] ) )Here’s a sample I made:
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-easonf-msft
6 years agoCommunity Support
Hi, Anonymous
“LOOKUPVALUE” function is not the right direction here. We can use a measure as below to work on it.
Price =
VAR maxdate =
CALCULATE (
MAX ( Price[Date(when start work with this price)] ),
FILTER (
Price,
Price[Shop] = Customer[Shop]
&& Price[Prod_id] = Customer[Prod_id]
&& Price[Date(when start work with this price)] < Customer[Date]
)
)
RETURN
CALCULATE (
MAX ( Price[Price] ),
FILTER (
Price,
Price[Date(when start work with this price)] = maxdate
&& Price[Shop] = Customer[Shop]
&& Price[Prod_id] = Customer[Prod_id]
)
)Here’s a sample I made:
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
6 years agoNot applicable
Thank you so much. It works perfectly.
You rock!!!!