Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Change image dynamically through slicer hierarchy

Hello there,

 

I have seen other posts talk about changing images dynamically with slicers but I haven't seen anyone mention this specific case yet.

 

I have this sample table "Continent > Country > City" and I created a slicer with those three fields, so it was displayed like this:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

So, the point is to show a different image depending on the case selected, BUT, also considering different steps of the hierarchy. For example, if Paris is selected, I would want to show an image of Paris (via url, by the way) like this:

 

 

 

 

 

 

 

 

 

 

 

 

But if France is selected, which would make Nice and Paris selected, I want to show a picture of France, like this:

 

 

 

 

 

 

 

 

 

 

 

 

 

So, is there any way I can make this happen?

 

Thank you for your time and patience.

 

Regards,

 

 

 

 

  • Anonymous 

    That table is not enough.  You will need the image URLs for cities and countries at least.  You can adopt several structures. One of them in the attached file, where you can see it all at work.

    You can create a measure that will yield the desired URL depending on the selection on the slicer. That can then be the input for the visual showing the images

     

    _VisualInput = 
    IF (
        ISFILTERED ( Table1[City] ),
        SELECTEDVALUE ( Table1[City_Image] ),
        IF ( ISFILTERED ( Table1[Country] ), SELECTEDVALUE ( Table1[Country_Image] ) )
    )

     

    Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

     

3 Replies

  • AlB's avatar
    AlB
    Icon for Community Champion rankCommunity Champion

    Anonymous 

    That table is not enough.  You will need the image URLs for cities and countries at least.  You can adopt several structures. One of them in the attached file, where you can see it all at work.

    You can create a measure that will yield the desired URL depending on the selection on the slicer. That can then be the input for the visual showing the images

     

    _VisualInput = 
    IF (
        ISFILTERED ( Table1[City] ),
        SELECTEDVALUE ( Table1[City_Image] ),
        IF ( ISFILTERED ( Table1[Country] ), SELECTEDVALUE ( Table1[Country_Image] ) )
    )

     

    Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

     

  • AlB's avatar
    AlB
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    Can you share the pbix, by any chance? Or at least a sample of your data showing the structure of your tables  and the kind of visual you are using (the one showing the pictures)

     

    Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi AlB 

      I sadly can't share the file, but I don't think it's necessary because it's a very simple table like:

      ContinentCountryCity
      EuropeSpainMadrid
      EuropeFranceParis
      EuropeFranceNice
      AmericaUSANew York

       

      And the image in the screenshot is a picture I downloaded for the example and paste it in the report, but in the real scenario it would be another table with a column of the sharepoint file url where the pictures are and a column of the City/Country/Continent (depending on what the picture is).

       

      Apologies for not being able to upload the file, I tried to explain the situation as best as I could.

       

      Thank you,