Changing text color is easy - this can be handled via native conditional formatting and a SWITCH(TRUE()) construct. But there’s currently no way to do native conditional formatting on other text properties like bold. Thus, you’ll need a custom visual. I really like K Teams Solutions HTML CSS Viewer custom visual to handle this (interesting note: developed by @PascalKiefer , a longtime eDNA member).
I’m just beginning to scratch the surface of what this amazing visual can do, but it handles your requirement pretty easily. Here’s how I did it:
One measure for the HTML code for the Card title:
Card Title Text HTML =
"<div id=container>
Total Annual Sales
</div>"
And one measure for the CSS code to format the title, controlling color, font and font attributes (in this case bold via the font weight):
Card Title CSS =
VAR Style1 =
"#container {
color:#5C63A8;
font-family: Arial;
font-size:32px;
font-weight:100;
padding-top:0px;
position:fixed;
width:100%;
display:block;
}"
VAR Style2 =
"#container {
color:#E61A23;
font-family: Arial;
font-size:32px;
font-weight:800;
padding-top:0px;
position:fixed;
width:100%;
display:block;
}"
VAR Result =
IF( [Total Sales] > 40000000,
Style2,
Style1
)
RETURN Result
Now just drop these two measures into the field well of the HTML-CSS visual, and you’re good to go:
I’ve put together a YouTube video on this for later this week, and we will be developing a lot more content about this visual over the course of the year.
I would also highly recommend checking out the K Team Solution’s site and downloading their sample PBIX, which illustrates all sorts of incredible things you can do with this visual.
I hope this is helpful.
- Brian