Showing results for 
Search instead for 
Did you mean: 
Not applicable

Lookup on two tables and get value in the first table using different data types



I am trying to use lookup function to get account values from two tables into the first table.


Table 1 is the master table and has two primary keys one text and one int, Table 2 is connected with text and table 3 with int to table 1.


I am trying to lookup on table 2 using text column to get the account value and if it is not present(blank) in table 2 then use table 3 using int as primary key to get the account value. I am using the below code.


The impact subtype and impact type are text columns and impact # is the integer.



Account =
LOOKUPVALUE(Default[Account],Default[Impact SubType],impact[Impact type > Metric]),
LOOKUPVALUE(Exceptions[Account],Exceptions[Impact #],impact[impact #]),
BLANK()) </>
Can someone please help on how I can approach this.
Super User
Super User

@Anonymous , Please share a sample. I might use two step approach At a time we can move data from one table to another


refer 4 ways to copy data from one table to another

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
!! Subscribe to my youtube Channel !!
Not applicable

Hi @amitchandak ,


This is the main table



and it is getting data from two other tables with two primary keys


Table 2:


and Table 3



Table 2 and 3 have different primary key datastructure. 

If it is blank in table 2, the query should go to table 3 and fetch the corrosonding data and store it in the same column.



Hi @Anonymous,

I'd like to suggest you add an index field to 'table 3', then you can write a measure to use lookupvalue function and if statement to find corresponding values.

Add an index column | Microsoft Docs

Table visual design:

Index and Key_Str from 'table 3' as category, measure as value.

Measure =
VAR currIndex =
    MAX ( Table3[Index] )
VAR currAccount =
    LOOKUPVALUE ( Table3[Account], Table3[Index], currIndex )
VAR lookupAccount =
    LOOKUPVALUE ( Table2[Account], Table2[Key_int], currIndex )
    IF ( currAccount <> BLANK (), currAccount, lookupAccount )


Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Power BI Show Ep 4 Post Show Carousel.jpg

The Power BI Community Show

Shabnam Watson demos Incremental refresh & Hybrid Tables and Leila Etaati demos Charticulator.

PBI April Release 2022 768x460.png

Check it out!

Click here to read more about the April 2022 updates!

Power BI Dev Camp Session 22 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!