Conditional formatring x-axis power bi

Viewed 327

I'm trying to color the x-axis ticks on a bar chart. The name of the 3 worst bars should by displayed as red. enter image description here

In this picture, this should be Envelops, Labels and Fasteners

I tried the following:

RANKX(
    FILTER(
        ALLSELECTED(superstore[Sub-Category]),CALCULATE(SUM(superstore[Sales])>0)),
        CALCULATE(SUM(superstore[Sales])),,ASC)


VAR bottom3 =
IF(
    rang < 4 , 
    "#FD625E",
    "#F1F2F7")

RETURN
bottom3

and if i look at the result in a table:

enter image description here

it seems to make sense. However when i use the measure for conditional formatting in x-axis, it does not work. All ticks are still white

1 Answers

It looks like conditional formatting for X-Axis's values expects to get just one (Total) value. This is why you've seen only grey labels on your visual. I mean that you are able only to paint all the labels the same color at once. And this function just lets you set this only color dynamically.

I've used your measure with some modifications on dummy data and got such results: enter image description here (_rank is a _rank variable used as measure. Other measures have more understandable names, I guess)

On this screenshot you can see the bar plot with bars painted by Measure and labels painted by MeasureWithAnotherRankValue (colors are explained in the table on the right). Here you can see also that labels' color is set by Total _rank value.

My dummy data (in case if you are going to check my answer):

Letter Value
A 1
B 5
C 10
Related