Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Condition with image by cloudscope

Hello,

 

I have a filter and image by cloudscope as shown: 

 

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

  • Hi , Anonymous 

    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:

    (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 :

    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

3 Replies

  • Hi , Anonymous 

    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=2' 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 :

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

    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

    • Anonymous's avatar
      Anonymous
      Not applicable

      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

      • v-yueyunzh-msft's avatar
        v-yueyunzh-msft
        Community Support

        Hi , Anonymous 

        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:

        (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 :

        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