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

14 REPLIES 14
Highlighted

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.

 

MFelix_1-1600096911574.png

Check PBIX file attach.

 

Not very conventional and measure may need some tweaking but can be one option 😉.

 

 

 


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

NICE!

 

but you cannot set the transparency level for a button fill.... must be a bug

 

/jens chr

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

Highlighted

@MFelix 

 

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...)





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

@PaulDBrown ,

 

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


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





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