Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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:
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:
I would have expected transparent to work according to the css-colo-3 document:
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
Solved! Go to Solution.
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsI 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
Proud to be a Super User!
Paul on Linkedin.
Hi @PaulDBrown ,
Has you can see on the scatter chart you can also use this trick:
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks 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.
Proud to be a Super User!
Paul on Linkedin.
Hi @PaulDBrown ,
Maybe you can think outside of the box. I'm assuming you aren't setting the colour manually, so picking up this post by @Phil_Seamark and making some adjustment on the way I get the information I was abble to get an automatic colour coding adding then a 50% transparency).
Condittional Formatting =
VAR MaxR =
MAXX ( SUMMARIZE ( 'Table'; 'Table'[CAt]; 'Table'[Value] ); 'Table'[Value] ) * 1000000000
-- 1000000000 this value is used to increase the spectre of colours the smaller the number the lower the nummber of colours.My values were between 100 and 1000 so the range was prety low in terms of colours
VAR MinR =
MINX ( SUMMARIZE ( 'Table'; 'Table'[CAt]; 'Table'[Value] ); 'Table'[Value] ) * 1000000000
VAR R =
ROUND ( ( MaxR - MinR ) + MinR; 0 )
VAR G =
ROUND ( ( MaxR - MinR ) + MinR; 0 )
VAR B =
ROUND ( ( MaxR - MinR ) + MinR; 0 )
VAR Base = 16
VAR BitTable =
GENERATESERIES ( 1; 8 )
VAR DEC2HEXR =
CONCATENATEX (
BitTable;
VAR c =
MOD ( TRUNC ( R / POWER ( base; [value] - 1 ) ); base )
RETURN
SWITCH ( c; 10; "A"; 11; "B"; 12; "C"; 13; "D"; 14; "E"; 15; "F"; c );
;
[Value]; DESC
)
VAR DEC2HEXg =
CONCATENATEX (
BitTable;
VAR c =
MOD ( TRUNC ( G / POWER ( base; [value] - 1 ) ); base )
RETURN
SWITCH ( c; 10; "A"; 11; "B"; 12; "C"; 13; "D"; 14; "E"; 15; "F"; c );
;
[Value]; DESC
)
VAR DEC2HEXB =
CONCATENATEX (
BitTable;
VAR c =
MOD ( TRUNC ( B / POWER ( base; [value] - 1 ) ); base )
RETURN
SWITCH ( c; 10; "A"; 11; "B"; 12; "C"; 13; "D"; 14; "E"; 15; "F"; c );
;
[Value]; DESC
)
RETURN
"#"
& LEFT ( { DEC2HEXR } & { DEC2HEXG } & { DEC2HEXB }; 6 ) & "50"
Has you can see below the information gives out a different colour with 50% transparency for each colour, changing the scheme of the categories replace also the colours.
Check PBIX file attach.
Not very conventional and measure may need some tweaking but can be one option 😉.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Português
Pretty amazing work there Miguel! thanks for the effort! I'll give it a try (and hope we eventually get a nice little transparency slider in the near future...)
Proud to be a Super User!
Paul on Linkedin.
Been playing around and you probably need sometimes to first do the condittional formatting and then add the categories, but it's just a questions of order in the steps for sure you are used to it in other visualizations.
😂😂😂
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsNICE!
but you cannot set the transparency level for a button fill.... must be a bug
/jens chr
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
Proud to be a Super User!
Check out my blog: Power BI em Português@jcu Sorry, what is the purpose of a transparent color? Is this like drawing red lines with transparent markers?
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
Title is wrong: should say TRANSPARENT
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThx 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
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.
Check PBIX file attach.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsLove this trick -thanks for sharing!