cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

How to specify 'ransparent' as a color in conditional fill Color on Button

Using Button with conditional formatting works very nicely most of the time,

 

BUT:

 

When I try to specify 'transparent' in the name of the color for background on an icon using a variable for conditional fill color, I get an error.

 

According to:

https://docs.microsoft.com/da-dk/power-bi/create-reports/desktop-conditional-table-formatting#color-...

Color by color values

If you have a field or measure with color name or hex value data, you can use conditional formatting to automatically apply those colors to a column's background or font color. You can also use custom logic to apply colors to the font or background.

The field can use any color values listed in the CSS color spec at https://www.w3.org/TR/css-color-3/. These color values can include:

  • 3, 6 or 8-digit hex codes, for example #3E4AFF. Make sure you include the # symbol at the start of the code.
  • RGB or RGBA values, like RGBA(234, 234, 234, 0.5).
  • HSL or HSLA values, like HSLA(123, 75%, 75%, 0.5).
  • Color names, such as Green, SkyBlue, or PeachPuff.

 

I would have expected transparent to work according to the css-colo-3 document:

 

4.2.3. transparent’ color keyword

CSS1 introduced the ‘transparent’ value for the background-color property. CSS2 allowed border-color to also accept the ‘transparent’ value. The Open eBook(tm) Publication Structure 1.0.1 [OEB101] extended the ‘color’ property to also accept the ‘transparent’ keyword. CSS3 extends the color value to include the ‘transparent’ keyword to allow its use with all properties that accept a <color> value. This simplifies the definition of those properties in CSS3.

transparent Fully transparent. This keyword can be considered a shorthand for transparent black, rgba(0,0,0,0), which is its computed value.

Maybe I joust need to specify the value in another way, '#800000' and 'red' both works.

 

/ Jens Chr

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Using a measure like this is giving me an error also and telling me to send out a report.

 

With my previous experience when I sendon out the report I got a response from microsoft pretty quickly.

 

However if you take out the transparent part from the measure and use the transparency of the button fill the error goes away, in this case you can use the full colour with the measure and set the button fill transparency on the options.

 

Again just streching out the possibilities and trying to give alternatives, some may not work in some context but it's a trial and error.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

14 REPLIES 14
Highlighted
Frequent Visitor

Title is wrong: should say TRANSPARENT

Highlighted
Super User IV
Super User IV

@jcu Sorry, what is the purpose of a transparent color? Is this like drawing red lines with transparent markers?


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Highlighted
Super User III
Super User III

Hi @jcu ,

 

the transparent colours are definid trough HEX codes adding two digits in the end of the colour something similar to :

 

Conditional formatting = "#ffffff00"

 

The two 0 can be replace from values until 99 being 00 fully transparent.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





Highlighted
Frequent Visitor

Thx for the reply, but

 

When I use the code:

 

#ffffff00

 

rendering fails with 'Something went wrong"

 

Using  

 

#ffffff

 

works, but naturally is not transparent...

 

/jens chr

Highlighted

The reason for the transparent fill color would be to 'not show' a button depending on some other data on the page.

 

So you are right, the purpose is to make it disappear

 

/jens chr

Highlighted
Super User II
Super User II

@jcu 

I wish you could set a transparency value in all colour formatting options (which you can't, unfortunately). Especially useful for example in scatter charts, where the larger (circular) values can cover smaller values. 
I actually submitted an "idea" for this a while ago in the ideas forum, but these kind of ideas never seem to get any traction





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Highlighted
Super User III
Super User III

Hi @jcu ,

 

this must not be set on the colour formattign you need to add a measure with this coding.

 

I have created the following code:

Condittional formatting =
SWITCH (
    SELECTEDVALUE ( 'Table'[CAt] );
    "A"; "#118DFF00";
    "B"; "#118DFF25";
    "C"; "#118DFF50";
    "D"; "#118DFF75"
)

It's always the same  colour but with different levels, has you can see below the chart on tyhe left shows different condittional formaating from transparent to 75% and on the rigth you have it witouth the condittional formatting.

 

MFelix_1-1600089923757.png

Check PBIX file attach.

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





Highlighted

Hi @PaulDBrown ,

 

Has you can see on the scatter chart you can also use this trick:

 

MFelix_0-1600090507719.png

 

 

Believe the idea did not had any traction because they imlpemented the condittional formatting, but agree with you would be better to have it native on the colour coding instead of condittional formatting or similar.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





Highlighted

@MFelix 

Thanks for that, Miguel. Unfortunately the dataset I needed it for had over 200 possible IDs (it is -yet another- coronavirus report) and the scatter chart was by region and country/area and comparing cases per million and deaths per million (bubble size being total number of cases), so difficult to establish transparency levels either individually or by conditional format: the ideal setting would in this case be a "global" transparency level setting for all colours displayed.

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors