Forum Discussion
How to get value from another table based on multiple criteria
Anonymous,
I am unsure about your expected result. When I use the following, I get the below results:
QuoteID1 =
IF (
AND (
Shipments[Departure] >= RELATED ( Quotations[Start Date] ),
Shipments[Departure] <= RELATED ( Quotations[Expiry Date] )
),
LOOKUPVALUE (
Quotations[QuoteID],
Quotations[Branch], Shipments[Branch],
Quotations[Department], Shipments[Department],
Quotations[Local Client], Shipments[Local Client],
Quotations[SrvLevel], Shipments[Srv Level],
Quotations[Origin], Shipments[Origin],
Quotations[Destination], Shipments[Destination]
)
)QuoteID2 =
LOOKUPVALUE (
Quotations[QuoteID],
Quotations[Branch], Shipments[Branch],
Quotations[Department], Shipments[Department],
Quotations[Local Client], Shipments[Local Client],
Quotations[SrvLevel], Shipments[Srv Level],
Quotations[Origin], Shipments[Origin],
Quotations[Destination], Shipments[Destination]
)
I am also unsure of performance as well.
- Anonymous8 years agoNot applicable
Hello ChrisMendoza,
Trying to follow your guideline but below error occurs:
what am I doing wrong?
Thanks, Tomas
- ChrisMendoza8 years agoResident Rockstar
Anonymous,
Seems like you do not have a relationship between the two tables. When I loaded your sample tables, Power BI established the relationship as the below for me:
Is your's not similar?
For Reference RELATED ( )
- Anonymous8 years agoNot applicable
Hi ChrisMendoza,
Relation is working if LocalClient is unique but if I add another Quotation for the same client but different Start and Expiry dates (very last row in below table) then relations dissapearring and your formula is not working.
BranchDepartmentQuoteIDLocal ClientSrvLevelOriginDestinationStart DateExpiry Date
BR2 241 QMT200002851 Customer1 LIF NLRTM DEBRV 2018.06.02 2018.06.30 BR2 241 QMT200002852 Customer2 FIL NLRTM DEBRV 2018.06.02 2018.06.15 BR2 241 QMT200002853 Customer4 LIL KRPUS DEBRV 2018.06.02 2018.06.30 BR2 241 QMT200002854 Customer5 LID KRPUS DEBRV 2018.06.02 2018.06.30 BR2 241 QMT200002855 Customer7 LIF DEHAM DEBRV 2018.06.02 2018.06.30 BR2 241 QMT200002856 Customer8 LIF DEHAM DEBRV 2018.06.02 2018.06.30 BR2 241 QMT200002857 Customer9 LID CNSHA DEBRV 2018.06.03 2018.06.15 BR2 241 QMT200002858 Customer10 LIF DEHAM DEBRV 2018.06.01 2018.06.30 BR2 241 QMT200002859 Customer10 LIF DEHAM DEBRV 2018.07.01 2018.07.31 Any thoughts how to solve such case?
Thanks in advance!