Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dvotf
Frequent Visitor

Dynamic Image Display

Hi guys,

 

I'm trying to find a way to dynamically display an image based on the values selected in a Slicer. For example, I might have a dataset that could be {Good, Medium, Bad} and I want to display either a Green, Orange or Red traffic light, depending on the worst case of what's selected. So the user would use the Slicer to select the data they want to see, and the image would change to reflect the worst case of this.

 

A simple example of the kind of table I'm looking at is:

 

Category | Severity | IconURL
     a        |       1      | http://bad.png
     a        |       2      | http://medium.png
     a        |       1      | http://bad.png
     a        |       3      | http://good.png
     b        |       3      | http://good.png
     b        |       2      | http://medium.png
     b        |       2      | http://medium.png
c | 3 | http://good.png

If the user picks Category A, I want to see 'bad.png', picking Category B gives 'medium.png' and Category C gives 'good.png'.

 

I've gotten somewhere using the ImgViewerVisual visualization, but I haven't been able to get it working properly. I can get the correct URL using a Measure but I can't set the Data Category to "Image URL" so it only displays as text. I've also tried creating a Custom Column that consists only of the URL with the worst (Min) Severity, but that does not respond to Slicer choices (no picking between Category A,B or C). I could do the the Min(Severity) on a by-category basis, but that will only work if the user is restricted to only picking one category at a time.

 

Has anyone any ideas on how to do this? I feel like it should be possible but I'm missing something.

1 ACCEPTED SOLUTION

You could probably do something along the lines of create a measure like:

 

Lowest = CALCULATE(MIN([Severity]),ALLEXCEPT(Table,Table[Category]))

 

Then create another measure like:

 

IsLowest = IF(SUM([Severity])=[Lowest],1,0)

 

Then drop your IsLowest as a filter on your table visualization of the error code images.

 

The idea here is that Lowest calculates to the MIN taking into account the Category. The IsLowest will be filtered by the row context of the table so only the lowest will be 1.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

14 REPLIES 14

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors