Forum Discussion
Lookup Value in multiple tables based on a key
- Anonymous5 years ago
I was able to solve it by doing the following
Date Column = var lookup1 = CALCULATE(FIRSTNONBLANK('Table 1' [Date], 1), FILTER( ALL ('Table 1'), 'Table 1'[Key] = 'Calc Table'[Key])) var lookup2 = CALCULATE(FIRSTNONBLANK('Table 2' [Date], 1), FILTER( ALL ('Table 2'), 'Table 2'[Key] = 'Calc Table'[Key])) var lookup3 = CALCULATE(FIRSTNONBLANK('Table 3' [Date], 1), FILTER( ALL ('Table 3'), 'Table 3'[Key] = 'Calc Table'[Key])) return IF(NOT(ISBLANK(lookup1)), lookup1, IF(NOT(ISBLANK(lookup2)), lookup2, IF(NOT(ISBLANK(lookup3)), lookup3)))
Hey Anonymous ,
with the information you gave:
I would try with CALCULATE and FILTER or with LOOKUPVALUE or with INTERSECT.
Sorry, selimovd, I am new to DAX so I'm not sure how I would write this out. I can do CALCULATE(FIRSTNONBLANK('Table 1' [Date], 1), FILTER( ALL ('Table 1'), 'Table 1'[Key] = 'Calc Table'[Key])) but this will only return the date for key values that match Table 1. I don't know how to search the other two tables.
- selimovd5 years ago
Most Valuable Professional
Anonymous that approach might probably work. As I said I don't know your data model, so I cannot tell you what to do. If you want help you have to provide more information.
Please read the following posts:
How to provide sample data in the Power BI Forum - Microsoft Power BI Community
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/2001860
Best regards
Denis