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
Anonymous
Not applicable

Picture changes on the percentage value of a measure

Hi All,

 

I will be thankful in advance for someone 's experience if they can share for below scenario:

 

I need to create a visual in my report showing one picture out of 3 pictures but picture is selected on the basis of percentage value of a specific measure.

 

For example ( Like conditional formatting in excel but not formatting but displaying picture )

  • if percentage of a measure X is between 0% - 60% then show RECTANGLE picture.
  • If percentage of a measure X is greater than 60% but less than equal to 80% then TRIANGLE picture
  • If percentage of a measure X is greater than 80% but less than or equal to 100% then SQUARE picture.

I am surprised not to find any help anywhere as all videos and solutions are talking about URL option. How can I fit URL option in this scenario and if any help or link someone can share, will be ideal.

 

Hope I explained well and above scenario is simplied version of what I am facing. But if you feel you need some more explanation please feel free to ask.

 

Thanks again for your much needed urgent help. 

 

Regards

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

We can try to use the following measure to meet your requirement (we use the url of forum's default avatars as an example)

 

Icon = 
IF (
    [X measure] < 0.6,
    "/t5/image/serverpage/avatar-name/skyscraper/avatar-theme/candy/avatar-collection/architecture/avatar-display-size/message/version/2?xdesc=1.0",
    IF (
        [X measure] < 0.8,
        "/t5/image/serverpage/avatar-name/castle/avatar-theme/candy/avatar-collection/architecture/avatar-display-size/message/version/2?xdesc=1.0",
        "/t5/image/serverpage/avatar-name/modern/avatar-theme/candy/avatar-collection/architecture/avatar-display-size/message/version/2?xdesc=1.0"
    )
)

 

7.jpg

 


If it doesn't meet your requirement, Could you please show the exact expected result based on the Tables that we have shared?


Best regards,

 

Community Support Team _ Dong Li
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
Greg_Deckler
Super User
Super User

Sure, you can set a measure to be a Data Category of Image URL and then you just need to return the correct Image URL based on the calculation. Or you can return an SVG image. Or just use the built-in conditional formatting icons.


@ 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...
Anonymous
Not applicable

Thanks very much for such a prompt reply.

 

Can you please elaborate a bit on 

set a measure to be a Data Category of Image URL and then you just need to return the correct Image URL based on the calculation.

 

I understand data category of Image URL but writing DAX to bring correct URL is causing problem

 

I have written DAX as below to display RECTANGLE or TRIANGLE -- ignored SQUARE, just so it runs atleast


IconFlag = SWITCH(True()
,CALCULATE(DISTINCT(tbl_Icons[IconURL])
,FILTER(tbl_Icons
,CONTAINSROW(
{IF( [X measure] <= 0.60,"RectangleURL","TriangleURL")}
,tbl_Icons[IconURL]
)))=1
,1,0)

 

where tbl_Icons contain RectangleURL, TriangleURL and SquareURL.

 

I followed instructions from 

https://visualbi.com/blogs/microsoft/powerbi/dynamically-display-images-power-bi/ 

 

Can you please help writing DAX to dynamically select image on the basis of measure value.

 

regards

 

 

Hi @Anonymous ,

 

We can try to use the following measure to meet your requirement (we use the url of forum's default avatars as an example)

 

Icon = 
IF (
    [X measure] < 0.6,
    "/t5/image/serverpage/avatar-name/skyscraper/avatar-theme/candy/avatar-collection/architecture/avatar-display-size/message/version/2?xdesc=1.0",
    IF (
        [X measure] < 0.8,
        "/t5/image/serverpage/avatar-name/castle/avatar-theme/candy/avatar-collection/architecture/avatar-display-size/message/version/2?xdesc=1.0",
        "/t5/image/serverpage/avatar-name/modern/avatar-theme/candy/avatar-collection/architecture/avatar-display-size/message/version/2?xdesc=1.0"
    )
)

 

7.jpg

 


If it doesn't meet your requirement, Could you please show the exact expected result based on the Tables that we have shared?


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.