Bar charts in Power BI: when bars beat columns

When to use a horizontal bar chart in Power BI instead of columns, the clustered, stacked and 100% stacked kinds, a Top N ranking with DAX, and the mistakes that make bar charts hard to read.

Short answer: a bar chart is a column chart turned on its side: the categories run down the Y-axis and the length of each bar is the value. Use it when the category names are long, when there are more than about 12 categories, or when the chart is a ranking read from top to bottom. Like columns, it comes as clustered, stacked and 100% stacked, and the axis must start at zero.

The chart, part by part: What is a bar chart? draws its parts and shows how to read one, its kinds and the mistakes to avoid.

A column chart with 25 product names on its X-axis turns the names sideways or cuts them off. The same data as bars has room for every name, sorted, with the biggest on top: a list the eye can read like a table.

The short video below shows the three rules that fix most bar charts: sort the bars, start the axis at zero, and turn the bars sideways when the labels are long.

Nothing loads from YouTube until you press play. Then Google receives your IP address and may set its own storage. Narrated with an AI-generated voice. Privacy

When should you pick bars over columns?

The dataPickWhy
Up to 12 short categoriescolumns or barsboth work; columns save height
Long names (products, customers, campaigns)barsthe name sits horizontally, in full
More than 12 categoriesbarsthe chart grows downwards and scrolls
A ranking, best firstbarsread top to bottom like a list
Time (months, quarters)columns or a linetime runs left to right
Bars or columns

Take the ten best products of a bike shop by revenue. As bars, sorted descending, the top product is the first thing anyone reads.

02505007501,0001,2501,250Mountain-200 Black, 42980Road-150 Red, 48760Touring-1000 Blue, 50610Mountain-100 Silver, 38480Road-650 Black, 52220Sport-100 Helmet, Red
Top products by revenue (in thousands), sorted descending

What do clustered, stacked and 100% stacked bars show?

The same as for column charts, turned sideways. Clustered bars compare series inside each category; stacked bars show the total and its parts; 100% stacked bars show only the mix, which suits survey answers well:

  • Easy
  • Neutral
  • Hard
0%20%40%60%80%100%DesktopTabletPhone
Answers to "How easy was checkout?" by device, as shares

On a phone, a quarter of the answers say "Hard": the 100% bar shows it at once, whatever the number of answers per device.

How do you show only the top 10?

Two ways. The quick one is the visual filter: in the Filters pane, on the product field, Filter type: Top N, Show items: Top 10, By value: Sales Amount. It is fixed to that visual.

The measure way keeps the rank available for titles, tooltips and other visuals:

Product Rank =
RANKX ( ALLSELECTED ( 'Product'[Product] ), [Sales Amount], , DESC, DENSE )

Sales Top 10 =
IF ( [Product Rank] <= 10, [Sales Amount] )

Put Sales Top 10 on the X-axis: products outside the top 10 return blank and drop out of the chart. ALLSELECTED ranks within what the slicers leave, so with a "Bikes" slicer the chart shows the ten best bikes.

To add an "Others" line that keeps the total honest, the product list needs a row called Others (a small calculated table) and a measure that returns the rest for it. TOPN in DAX builds that pattern step by step.

How do you build one, step by step?

  1. In Visualizations pick Clustered bar chart (or stacked, or 100% stacked).
  2. Drag the category to Y-axis and the measure to X-axis; a series field goes to Legend.
  3. More options (...), Sort axis, by the measure, Sort descending: the biggest bar is on top.
  4. In Format visual, turn on Data labels and turn off the X-axis values if the labels carry the numbers; widen the Y-axis if names are cut.
  5. With many categories, keep the visual tall enough for a readable bar height; the visual scrolls when the bars do not fit.

What goes wrong?

  • Sorted alphabetically. The default sort can be by name; a ranking is sorted by value, descending.
  • Cut-off names. Power BI shortens long Y-axis labels; give the axis more width in the format pane or shorten names in the model (a "Short Name" column).
  • An axis that starts above zero. A bar's length is its value; an axis from 500 makes 600 look twice as long as 550.
  • Top N without context. A top 10 hides how much the rest sells. Add an "Others" bar or put the share of the total in a tooltip.
  • Bars for time. Months stacked downwards read against habit; time goes left to right as columns or a line.

Where can you check this?

Where do you start?

Pick bars whenever the names are long or the chart is a ranking, sort by value and start at zero. RANKX in DAX explains the ranking measure in full, and which chart for which question compares bars with the rest.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.