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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
bonjourposte
Helper V
Helper V

Returning default image

I am trying to return a certain default image if a neighborhood is selected in the bar chart filter, but I don't have a corresponding picture for the city that the neighborhood is in.  I have a key that corresponds cities and all the neighborhoods that are in them ("FSA to City Key"):

 

bonjourposte_1-1678611029343.png

 

 

Nothing I try will return the default "Canada" image for a neighborhood with no corresponding city picture.  My code is:

 

Image =
VAR img =

IF(
    ISEMPTY(VALUES('Image Table'[City.jpg])),
            "data:image/jpg;base64, " &
            CONCATENATEX
            (
            FILTER (
            'Image Table',
            'Image Table'[City.jpg]="Canada.jpg"),
            'Image Table'[Pic],
            ,
            'Image Table'[Index],ASC)
            ,
            "data:image/jpg;base64, " &
            CONCATENATEX('Image Table',
            'Image Table'[Pic],
            ,
            'Image Table'[Index],ASC)
    )
RETURN img

 

(The concatenating function works fine, it's just the first line after "IF" that I'm having trouble with.)

 

I have tried IF(NOT(HASONEVALUE), IF(ISEMPTY(VALUES)), and IF(COUNTROWS)=0 and nothing works. I don't know what else to try.  Is the "many to many" relationship a problem here?  It's many to many because in the Images Table, I need multiple rows concatenated together to handle the base 64, and in the FSA to City key, the cities are listed multiple times because there are several neighborhoods per city. 

 

I don't see how the many-to-many could be a problem because when I filter my '2021 FSA API Data' table with an FSA with no corresponding city image, there should literally be no city rows to show in my Image Table.

 

Or could it have something to do with the .jpg?  FSA matches with the city.jpg merged in FSA to City Key, which which then matches with the city.jpg in the Image Table.

 

Where is the issue?

 

This is the error message I get when I click on a neighborhood where I don't have a corresponding city: 

bonjourposte_0-1678611393415.png

 

0 REPLIES 0

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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