Forum Discussion
Conditionally Format X-Axis
- 1 year ago
Hi MichaelaMul
Unfortunately the conditional formatting for the X-axis is computed once for the entire axis, not for each individual label on the X-axis. The axis labels must all be formatted the same colour.
If you examine the DAX query generated by the visual using Performance Analyzer, you will see a portion of the query similar to below that returns the minimum (i.e. "first") Brand in order to determine the axis text colour:
EVALUATE ROW( "MinBrand", CALCULATE ( MIN ( YourTable[Brand] ) ) )This is evaluated at the visual level, and the formatting condition would only be true when only the single Brand "Rakuten" is visible in the overall context of the visual.
There could be custom visuals out there that can do this, and I imagine it's possible to do this with Deneb if you want to explore that.
Regards
Hi MichaelaMul Could you try these please
- Create a New Column for Conditional Formatting:
X_Axis_Color =
IF(
[X_Axis_Field] = "Rakuten",
"Red",
"DefaultColor"
)
This column will assign "Red" to "Rakuten" and a default color to all other values.
- Apply Conditional Formatting:
- Go to the Formatting pane of your chart.
- Navigate to Data colors or X-axis formatting.
- Select Conditional Formatting and set it to use the newly created column.