Forum Discussion

Revokez's avatar
Revokez
Frequent Visitor
6 years ago
Solved

Filtering by whether Image Exists or Not

Hi

 

I've got a table of data that includes a column that pulls in an image URL using the Data Category: Image URL. However some of these images exist and some of these images don't exist. This means when I pull the data into a visualisation that some images show as broken links and others show the actual image.

 

What I would like to achieve is to filter to rows that only have an image that exists and so exclude those that have a broken link (and so don't show an image).

 

Is there any way to achieve this?

 

Thank you

  • Hi Revokez ,

     

    We can add a custom in power query editor to identify if this url is valid:

     

    let 
    ContentType = Binary.InferContentType(Web.Contents([Address]))[Content.Type],
    t = Table.RemoveRowsWithErrors(#table({"Type"} ,{{if Text.Contains(ContentType,"image") then 1 else null}} )),
    RemoveNull = Table.SelectRows(t,each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null})))
    in
    not Table.IsEmpty(RemoveNull)

     

     

    Then you can use it in any filter you want.

     

     

    If you are using the local file address, try to use the File.Content instead of Web.Content


    Best regards,

     

10 Replies

  • Hi Revokez ,

     

    You can simply deselect it from Filter Pane. I tried to replica your scenario and removed the broken icon image using Filter Pane. (Attached screen shot below for your reference)

     

    Please give Kudos to this efforts and accept this as a solution if it helps!

    • Revokez's avatar
      Revokez
      Frequent Visitor

      Tahreem24 

       

      Thanks - I have tried this however it doesn't work unfortunately due to the large quantity of broken images. Ideally if there was a way to 'group' the broken images and exclude them that way.

       

      Example screenshot of the column that shows multiple broken images.

       

      • Tahreem24's avatar
        Tahreem24
        Super User

        Hi Revokez ,

         

        I understand you requirement. What I suggest you to deselect the broken image value from Filter Pane. I do also have a multiple broken image and I applied this filter so got what you wanted to achieve. (Screen Shot attached Below)