Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello,
I am trying to find some way to change the transparency of images based on certain values. However, this is not really possible as far as I know. If you add an image to a dashboard visual, you can only change the transparency of the color of the background of the image, if you choose to enable a background for that picture.
BUT.... there is a way to change the transparency of an image by adding the image through a Blank Button. If you add a Blank Button, and you enable "Fill" under Style, for that button, you can browse and add an image to that button. And within that function, "Fill", there is a transparency slider - and this slider DOES change the transparency of the entire button including the image within it.
What I am trying to find out is if there is a code/command that I can use to manipulate that very slider. Again, I'm aware of how to change the transparency of a color, by adding "00" to the color hex code. But this slider is not just affecting a color, but an actual image. And I need to find out how I can control that slider in a measure.
Here are some images for better understanding...Blank Button
Style - Fill
Added image
Transparency slider
Hi Owen,
thanks for your help. Unfortunately, your first suggestion will not do the exact trick I need. I would need the image to turn 100% transparent based on certain values, to reveal another image that will be layered underneath it. That would be the ideal way. I have already considered your solution, which I will be force to go with. In that case I won't be able to layer multiple different images ontop of each other but I will have to place them next to each other and have them be visible or not, but that will take up space on the dashboard, which is why the layering ontop of each other would've been a better way.
I will look into the HTML idea.
It's unfortunate, though, because the transparancy slider is already doing the trick, when you insert an image through a blank button. It's just manual. I figured if that slider is doing that, there should be a way to control the slider through a command through DAX.
Again, thank you.
Erol.
Hi there @ErolOld,
Just posting a follow-up: It turns out that you can use a bit of a hack set certain properties (including transparency) by editing the visual.json files when using PBIP format. You may well have come across this yourself!
I had been experimenting myself and also saw this post that covers this method.
I have attached a demo PBIX.
I set this up in my demo PBIX by:
Original literal transparency value (set to 51% transparency as an example):
"transparency": {
"expr": {
"Literal": {
"Value": "51D"
}
}
}
Updated measure-based transparency (Entity = table, Property = measure name):
"transparency": {
"expr": {
"Measure": {
"Expression": {
"SourceRef": {
"Entity": "Transparency"
}
},
"Property": "Transparency Value Int"
}
}
}
I'm sure other variations are possible with other visuals.
Hopefully this is enabled in the Power BI Desktop interface soon!
Regards
Owen 🙂
Hi @ErolOld
One idea, which is a bit of a workaround, is to place a shape over the image with fill color set the same as the background colour but with alpha channel controlled by DAX.
This will give the appearance of the image's transparency being adjusted.
In my test PBIX, with the blue background, the Fill Color measure is:
Fill Color =
VAR TransparencyPct =
[Transparency Value]
RETURN
"RGBA(57,115,176," & TransparencyPct & ")"
Example attached.
Would this work in your situation?
Another idea you could try: Use HTML Content or HTML Content Lite, and construct HTML with DAX to display the image appropriately.
Regards