Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
cristianml
Post Prodigy
Post Prodigy

lookup value from table

Hi,

 

I need to do a Lookup value in PBI (like Vlookup in excel) but using two column or Table array and in case has an error type "Error" or anything I want.  I think using also OR / IF / IFERROR but i couldn't find a logical combination.

See Example below :

 

Table 1Table 2Data Result
A1A21
B1B22
C1C23
   
TableData result 
A11 
B12 
C13 
A21 
B22 
C23 
A3#N/A 
B3#N/A 
X#N/A 
1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @cristianml,

 

You can create a calculated column like this: (I suppose the above table is named as 'Table6', the bottom one is named as 'Table7')

Result =
IF (
    LOOKUPVALUE ( Table6[Data Result], Table6[Column1], Table7[Table] ) <> BLANK (),
    LOOKUPVALUE ( Table6[Data Result], Table6[Column1], Table7[Table] ),
    LOOKUPVALUE ( Table6[Data Result], Table6[Column2], Table7[Table] )
)

3.PNG

 

Alternatively, you can unpivot 'Table6' to convert its table structure to below:

2.PNG

 

Then, to do a Lookup value, please use this formula:

Result =
LOOKUPVALUE ( 'Table6'[Data Result], 'Table6'[Value], Table7[Table] )

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @cristianml,

 

You can create a calculated column like this: (I suppose the above table is named as 'Table6', the bottom one is named as 'Table7')

Result =
IF (
    LOOKUPVALUE ( Table6[Data Result], Table6[Column1], Table7[Table] ) <> BLANK (),
    LOOKUPVALUE ( Table6[Data Result], Table6[Column1], Table7[Table] ),
    LOOKUPVALUE ( Table6[Data Result], Table6[Column2], Table7[Table] )
)

3.PNG

 

Alternatively, you can unpivot 'Table6' to convert its table structure to below:

2.PNG

 

Then, to do a Lookup value, please use this formula:

Result =
LOOKUPVALUE ( 'Table6'[Data Result], 'Table6'[Value], Table7[Table] )

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you, ...  Unpivot columns was the most easy way. Thanks !

jthomson
Solution Sage
Solution Sage

Why not convert the two columns into one? Make a copy of the table, keep the first column in the first table and the second column in the second, give them the same name then append it?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.