Forum Discussion
Filtering by whether Image Exists or Not
- 6 years ago
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,
Hi Tahreem24 - I think the difference between my example and yours is that in mine, the broken images are all different URLs and so they don't all group together for filtering. Here's a screenshot of the filtering in my example:
- Revokez6 years agoFrequent Visitor
Tahreem24 Unfortunately I can't.
However as an example of their format (these aren't actual links):
www.domaintestpowerbi.com/sj0661_1.jpg
www.domaintestpowerbi.com/sj0662_1.jpg
www.domaintestpowerbi.com/sj0663_1.jpg
www.domaintestpowerbi.com/sj0664_1.jpg
www.domaintestpowerbi.com/sj0665_1.jpg
As an example, sj0665 might have a working image, however the rest could return 404s as the image doesn't exist.
- Revokez6 years agoFrequent Visitor
Hi Tahreem24
Unfortunately I can't.
But here's a few example URLs you can use to test the same scenario. Image one should display and the subsequent images will be broken and have seperate filtering:
Screenshot of how this displays in Power BI:
- v-lid-msft6 years agoCommunity Support
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,- Revokez6 years agoFrequent Visitor
v-lid-msft , that's exactly what I was after - perfect, thank you very much!