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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.