cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
malekzouaridk
Helper III
Helper III

Condition with image by cloudscope

Hello,

 

I have a filter and image by cloudscope as shown: 

malekzouaridk_0-1674554920632.png

 

When I don't select anything or more than 1, it shows me by default the first Picture, what I want is to display a message sayin that you can select only one value ?

 

Is that possible with this visual ?

 

Thanks

1 ACCEPTED SOLUTION

Hi , @malekzouaridk 

Thanks for your quick response! According to your description, you have the [Image Url] columns in your table.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1674727263515.png

(2)We can create a measure like this:

Measure = var _slicer = VALUES('Table'[Column1])
var _image =  MAX('Table'[Image])
return
IF(COUNTROWS(_slicer)=1 , " <html>
<body>
<img src='  "& _image & "    ' alt='Girl in a jacket' width='500' height='600'>
</body>
</html> " ,"
<html>
<body>
<h2>You need to select one!</h2>
</body>
</html>")

 

(3)Then we can also put the measure on the "HTML Content" visual and then we can meet your need :

vyueyunzhmsft_1-1674727308928.pngvyueyunzhmsft_2-1674727315398.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
v-yueyunzh-msft
Community Support
Community Support

Hi , @malekzouaridk 

According to your description, you want to when "select anything or more than 1" show the text "you need to select one" else show an image.

Here are the steps you can refer to :
(1)We can generate a web url for the image:

 
(2)Then we can create a measure :

Measure = var _slicer = VALUES('Table'[Column1])
return
IF(COUNTROWS(_slicer)=1 , " <html>
<body>
<img src='https://www.bing.com/th?id=OIP.W8apTKARTqVhmLzMCisNmAHaEs&w=174&h=185&c=8&rs=1&qlt=90&o=6&pid=3.1&rm...' alt='Girl in a jacket' width='500' height='600'>
</body>
</html> " ,"
<html>
<body>
<h2>You need to select one!</h2>
</body>
</html>")

 

(3)Then we need to add a custom visual :

vyueyunzhmsft_0-1674711029073.png

Then we put the measure on this visual and we can meet your need.

vyueyunzhmsft_1-1674711051732.png
vyueyunzhmsft_2-1674711059616.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Hello @v-yueyunzh-msft ,

 

Thank you for your time 🙂 

I think you misunderstand my needs, in fact I have a column with images URLS which are related to product name, so when I select a product his picture shows on, but when I select two products in my slicer it show me the first picture based on the name, what I want is when selecting a product it show me the right picture but when I select more than one product in my slicer it shows me a message with " You can select only one "

 

Hope I was clear

 

Thank you again for your time

Hi , @malekzouaridk 

Thanks for your quick response! According to your description, you have the [Image Url] columns in your table.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1674727263515.png

(2)We can create a measure like this:

Measure = var _slicer = VALUES('Table'[Column1])
var _image =  MAX('Table'[Image])
return
IF(COUNTROWS(_slicer)=1 , " <html>
<body>
<img src='  "& _image & "    ' alt='Girl in a jacket' width='500' height='600'>
</body>
</html> " ,"
<html>
<body>
<h2>You need to select one!</h2>
</body>
</html>")

 

(3)Then we can also put the measure on the "HTML Content" visual and then we can meet your need :

vyueyunzhmsft_1-1674727308928.pngvyueyunzhmsft_2-1674727315398.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Winner of T-Shirt Design

Power BI T-Shirt Design Challenge 2023

Find out who won the T-Shirt Design Challenge and the top 3 finalists.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.