Skip to content
Tutorials Center
My learning

Topics

Lesson 8 of 35 ยท Building Views

Tableau Bar, Line, Dual-Line and Area Charts: Step by Step

Build bar, side-by-side, stacked, line, dual-line and area charts in Tableau, choose discrete or continuous dates, and see the numbers behind each view with runnable stand-ins.

Bars compare categories, lines show change over time, and areas show how a total builds up. These three families cover most business charts. Each recipe below lists the pills to place, then a stand-in query shows the data that Tableau would draw.

Reminder: the TryIt blocks use SQL or Python to reproduce the aggregated numbers. They are not Tableau, so the actual drawing steps are in the numbered lists.

Bar chart

Use it for: comparing a measure across categories.

  1. Drag a dimension (Category) to Rows.
  2. Drag a measure (Sales) to Columns. Tableau draws horizontal bars.
  3. Click Sort Descending in the toolbar so the longest bar is on top.
  4. To make vertical bars, press Ctrl+W to swap rows and columns.

Good bar chart habits: start the axis at zero (bars encode length), sort by value unless the categories have a natural order, label the bars, and keep colors meaningful (one color for one measure).

Tableau can also show negative values in a different color: drag SUM(Profit) to Color and Tableau uses a diverging palette centered on zero, or Edit Colors and enable Stepped Color for fixed bands.

Side-by-side and stacked bars

Add a second dimension and the two bar variants appear.

  • Side-by-side bars: put Category on Columns and Segment on Columns after it (or put Segment on Color and Category on Rows, then use Show Me to choose "side-by-side bars"). Bars for each segment sit next to each other. Good for comparing values within a category.
  • Stacked bars: drag Segment to Color with Category on Rows. Each bar becomes a stack of segments. Good for totals and parts, bad for comparing the inner pieces except for the first one.
  • 100% stacked: right-click the measure pill and choose Quick Table Calculation > Percent of Total, then Compute Using > Table (Across) or pick the relevant dimension. Each bar has the same length and shows the share of each part.
SQL Stand-in: stacked totals and 100% shares

Press Run (or Ctrl + Enter) to see the result here.

The stack_size column is what a stacked bar draws; pct_of_bar is what you get after the percent-of-total table calculation computed along the segment.

Line chart

Use it for: a trend over time.

  1. Right-click Order Date and drag it to Columns; choose Month from the continuous (green) section (the second Month entry, the truncated date).
  2. Drag Sales to Rows. Tableau draws a line mark.
  3. To change granularity, click the pill's drop-down and pick Year, Quarter, Week or Day.
  4. Double-click the axis to format it, or right-click > Edit Axis to set a range.

Continuous dates draw a smooth line with a real time axis and gaps for missing months. A discrete date (blue) gives a header per period and merges the same month across years unless you also put YEAR(Order Date) on Columns.

For a month-over-month comparison of several years, put discrete MONTH on Columns and discrete YEAR on Color. You get one line per year laid over the same twelve months.

SQL Stand-in: continuous months versus year-over-year lines

Press Run (or Ctrl + Enter) to see the result here.

Now the same data as one line per year (discrete month on Columns, year on Color):

SQL Stand-in: one row per month, one column per year

Press Run (or Ctrl + Enter) to see the result here.

Dual-line charts

Two measures on one chart need a decision about the scale.

  • Measure Names / Measure Values: drag Measure Values to Rows, filter it to Sales and Profit, put Measure Names on Color. Both lines share one axis, so a small measure looks flat next to a large one.
  • Dual axis: put Sales on Rows, drag Profit to the right edge of the view until a dashed green drop line appears, then right-click the right axis and choose Synchronize Axis only if both use the same unit. Different scales help to compare shapes, but the crossing point of the lines has no meaning.
  • Two stacked panes: drop Profit on Rows next to Sales for two charts that share the date axis. This is the least misleading option.

Dual axes with different units can suggest correlations that are not there. Label each axis, color the axis text to match the line, and prefer stacked panes when you are unsure.

Area charts

An area chart is a line with the space below it filled. Choose Area in the Marks card's mark-type drop-down, or use Show Me.

  • Stacked area (the default when a dimension is on Color) shows how parts add up to a total over time: Month on Columns, Sales on Rows, Category on Color.
  • Continuous area needs a continuous date, so the area fills across all periods.
  • To remove stacking, use Analysis > Stack Marks > Off to get overlapping areas (use transparency in Color).

Use areas for totals and parts, not for exact comparison of the inner bands (only the bottom band shares a baseline). Do not use area charts for categories without order.

SQL Stand-in: the numbers behind a stacked area

Press Run (or Ctrl + Enter) to see the result here.

band_height is the thickness of one band, and total_height is where the top of the stack ends.

Choosing between them

Question Chart
Which category is biggest? Sorted bar
How do segments compare inside each category? Side-by-side bars
How big is the total and what are its parts? Stacked bar or stacked area
How has a number changed over time? Line
Do two measures move together over time? Two panes or dual axis (carefully)

Continue with distribution charts when you need to see spread instead of totals.

Common mistakes

  • Truncated bar axes that exaggerate differences.
  • Too many colors in a stacked bar. More than five segments are unreadable.
  • A discrete month with several years that merges years without anyone noticing.
  • Dual axes without labels.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which date pill gives a continuous monthly line with a real time axis?

    The green truncated month pill is continuous and produces an axis with one point for each month of each year.
  2. 2. What is the main weakness of a stacked bar chart?

    Segments that do not start at zero are hard to compare by eye; side-by-side bars are better for that.
  3. 3. How do you create a 100% stacked bar?

    Percent of Total turns each segment into a share of its bar, so every bar reaches 100 percent.
  4. 4. Why can a dual-axis chart be misleading?

    When axes use different scales, the visual relationship between lines is an artifact of the scaling.

Summary

  • Bars compare categories, so sort them and start at zero.
  • Side-by-side bars compare inside a category; stacked bars show totals and parts; 100% stacked shows shares.
  • Lines need a continuous date for a real time axis; use discrete month plus year on Color for year-over-year overlays.
  • Dual axes need honest labels; two stacked panes are safer.
  • Area charts show totals and parts over time.

Next: Distribution charts: histograms, box plots, scatter plots and heat maps