Forum Discussion
Horizontal Bar chart with Text Labels Above Each Bar AND conditional Formatting on Bars
- 1 year ago
Hi lancekam
This can be done, but in a very roundabout way. For a closer result, use the HTML visual. The left bar chart uses the native bar chart, while the right one is created with HTML, courtesy of AI after several prompts.
Please see the attached pbix
Hi lancekam
With the core Power BI visuals, it's not currently possible to combine conditional formatting on bars with text labels placed above the bars. This limitation exists because using a second axis or dummy placeholders breaks conditional formatting support.
There are two alternative approaches:
-
Instead of formatting the bars, format the data labels using a calculated column or measure with color logic (e.g., green for positive, red for negative). This workaround is demonstrated in this video:
https://www.youtube.com/watch?v=EiIAkJ9R7mM -
Use Deneb (a custom visual based on Vega-lite). It requires some coding but gives full control over bar formatting and text placement. A ready-made template is available here:
https://kerrykolosko.com/portfolio/compact-progress-bars/
From a UX perspective, placing the label above the bar reduces readability, especially with thin bars. It breaks the visual continuity needed for effective comparison. If the goal is to show progress or deviation, consider using a bullet chart as in the attached example. It preserves alignment and provides a more accessible layout.
PBIX file based on the example is attached.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickl