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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
gcampanine
Advocate II
Advocate II

Find matching value in related column and return link

Hello everyone!

 

I have two tables:
Table 1 (let's call it "Bank") has a code number for each registered bank and its name (it comes from our database);
Table 2 (let's call it "Plan") has a code number for each bank and a link to its logo image in google drive (it comes from an Excel file).

 

All codes in Plan are in Bank, but not all codes in Bank exist in Plan.

 

I need to create a calculated column in Plan that checks if the selected value in Bank exists in Plan. If it exists, then the column shows the corresponding link. If not, then it shows a specific link.

I am using the Simple Image visual to show the image, so the link column is marked as Image URL. This visual only accepts a column as value.

 

I have tried this dax expression:

Coluna = 
IF(
    SELECTEDVALUE(Bank[Code]) IN Plan;
    Plan[link];
    "my-link"
)

but I am getting an error saying that "function CONTAINSROW must have a value for each column in the table expression.

 

Anyone have any idea about how to solve this?

Thank you!


EDIT:

I tried this dax expression:

Coluna = 
IF(
    HASONEVALUE(Plan1[banco]);
    SELECTEDVALUE(Plan1[link 3]);
    "my-link"
)

but it always shows the static link image, no matter if there is a corresponding image to the selected bank code.

1 ACCEPTED SOLUTION

@v-chuncz-msft thank you for your response!

 

I reached another solution, a bit more complicated, but it worked just fine Smiley LOL

I created this calculated column in Bank, because I realized that my logic of creating it in Plan was wrong:

 

Coluna =
VAR CHECK =
    CALCULATE (
        COUNTROWS ( Plan ),
        FILTER ( Plan, Plan[code] = EARLIER ( Bank[Code] ) )
    ) > 0
VAR LINK =
    CALCULATE (
        FIRSTNONBLANK ( Plan[link], Plan[link] ),
        ALLEXCEPT ( Bank, Plan[code] )
    )
RETURN
    IF ( CHECK, LINK, "my-link" )

 

 

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@gcampanine 

 

You may just use LOOKUPVALUE.

Column =
LOOKUPVALUE ( Plan[link], Plan[Code], Bank[Code], "my-link" )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft thank you for your response!

 

I reached another solution, a bit more complicated, but it worked just fine Smiley LOL

I created this calculated column in Bank, because I realized that my logic of creating it in Plan was wrong:

 

Coluna =
VAR CHECK =
    CALCULATE (
        COUNTROWS ( Plan ),
        FILTER ( Plan, Plan[code] = EARLIER ( Bank[Code] ) )
    ) > 0
VAR LINK =
    CALCULATE (
        FIRSTNONBLANK ( Plan[link], Plan[link] ),
        ALLEXCEPT ( Bank, Plan[code] )
    )
RETURN
    IF ( CHECK, LINK, "my-link" )

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors