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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
DMT_corp
Regular Visitor

undefined

Hi . I have pictures of cities . What code in M language help me in terms putting city's pictures right after it's name. I mean whenever i put name of city, picture of it shoult be cropped next to it  . How can i do that ?

 

 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @DMT_corp ,

 

To essentially 'hardcode' this behaviour, you can just insert images into your report by going to the Insert tab > Image.

To do this dynamically, you will need to create a table in Power Query that has a column for image ID (that can be related to any other tables in the model), and a column that contains the full URL as text type to the image, something like this:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("lc5BCoMwEAXQuwTc1YyNCtoD1E1vICI2SWNo4gRNanv7xoLQTRddzMDnw8xrW6IQlZENOZDRe7ecAIIzOAi66ru2UuiB4qxgS25LwNFanBbwY7BXKKHMofnc6BPGmjj9BRXS5aGAZUXlnumPmrpJke6wE87BmC/FLBfKDQahp2F+0fgVhLQI2g5Kwk16PsLal0UBf7o58HoXm0iJroplxzyNq0xYvdFI170B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [imageID = _t, URL = _t])
in
    Source

BA_Pete_0-1669638728458.png

 

Once you apply this to your data model, select the URL column fom the fields list, go to the Column Tools tab > Data Category (dropdown) and select 'Image URL'.

 

You can now relate your [imageID] column to other tables in your model the same way you would for any other dimension table, and bring the URL column into tables to display the image, like this:

BA_Pete_1-1669638887417.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

1 REPLY 1
BA_Pete
Super User
Super User

Hi @DMT_corp ,

 

To essentially 'hardcode' this behaviour, you can just insert images into your report by going to the Insert tab > Image.

To do this dynamically, you will need to create a table in Power Query that has a column for image ID (that can be related to any other tables in the model), and a column that contains the full URL as text type to the image, something like this:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("lc5BCoMwEAXQuwTc1YyNCtoD1E1vICI2SWNo4gRNanv7xoLQTRddzMDnw8xrW6IQlZENOZDRe7ecAIIzOAi66ru2UuiB4qxgS25LwNFanBbwY7BXKKHMofnc6BPGmjj9BRXS5aGAZUXlnumPmrpJke6wE87BmC/FLBfKDQahp2F+0fgVhLQI2g5Kwk16PsLal0UBf7o58HoXm0iJroplxzyNq0xYvdFI170B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [imageID = _t, URL = _t])
in
    Source

BA_Pete_0-1669638728458.png

 

Once you apply this to your data model, select the URL column fom the fields list, go to the Column Tools tab > Data Category (dropdown) and select 'Image URL'.

 

You can now relate your [imageID] column to other tables in your model the same way you would for any other dimension table, and bring the URL column into tables to display the image, like this:

BA_Pete_1-1669638887417.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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