6. Line and Area Charts

Overview

Line charts and area charts are commonly used in Power BI for tracking trends, especially over time. We’ll learn how to use them in this lesson.

To explore more Kubicle data literacy subjects, please refer to our full library.

Summary

  1. Lesson Goal (00:10)

    The goal of this lesson is to visualize data over time using line and area charts.

  2. Understanding the Line Chart (00:20)

    A line chart is used to analyze the trend in a variable over time. It shows data as a series of points linked by a line. In this lesson, we use a line chart to analyze the number of sales our company makes each month of the data set.

    When we add a date field to a chart in Power BI, a hierarchy of year, month, week, and day is created. We can view data by any of these time periods. When we add a legend to a line chart, there will be one line for each value of the legend field. Here, we add region as a legend. This allows us to see a separate line for each region. We can easily compare the sales trends over time and compare trends for each region using a single line chart.

  3. Understanding the Area Chart (01:30)

    An area chart is another chart used to visualize a variable over time. An area chart is simply a line chart with the area underneath the line or lines shaded. This should make it easier to see the changes in magnitude of a line. The area chart can work well with a single line, but is less effective when there are multiple lines. This is because the area under each line overlaps and the lines may cross, making the chart more difficult to read.

    On line charts and area charts, the lowest value on the y-axis does not have to be zero. This is not an issue for line charts, as these charts focus on identifying trends rather than amounts. However, this may be confusing for area charts. As a result, you may want to modify the formatting of this axis or use a different type of chart.

  4. Understanding the Stacked Area Chart (02:54)

    The stacked area chart is an area chart where multiple lines are stacked on top of each other instead of overlapping. As a result, each of the areas is easier to see than on a standard area chart. The stacked area chart can be preferable to a standard area chart when you have multiple lines or lines that cross each other.

Transcript

In the previous lesson, we learned how to add report page tool tips to our visualizations.

In this lesson, we'll learn how to visualize data over time using line charts and area charts.

We'll start by looking at line charts. The line chart is another chart that's frequently used in reports and dashboards. These charts are most commonly used to analyze the trend in a variable over time.

Let's say we wanna analyze the number of customers by month. We want to get an idea of whether there are more or fewer transactions at certain times of the year. Before we bring our data onto the canvas, we'll select a line chart from the visualizations pane, creating a blank line chart.

We'll then drag the date field to the axis well, and the company name field to the values well. By default, the date field comes as a hierarchy of year, quarter, month, and day. We'll discuss this in greater detail in later lessons, but for now we're only concerned with the number of companies by month. As such, we'll get rid of year, quarter, and day by selecting the Xs next to them. We can see that the number of customers varies by month and seems to drop off considerably towards the end of the year. Let's modify this graph by adding the region field as a legend.

We now have four different lines, one for each region. Let's move on and look at area charts.

Area charts are similar to the line charts, however, the area underneath each line is shaded.

We'll convert our line chart to an area chart by selecting the appropriate button in the visualizations pane.

In theory, this should make it easier to see the changes in magnitude of each line but with four lines on our chart, it's a bit unclear. Let's take the legend out again and go back to a single line.

The area chart now works quite well. The variations in data are much easier to see than with a simple line chart. Note that the bottom of the y-axis is not zero on line in area charts.

So while December is smaller than all other months, it's not as close to zero as you might think. Line charts generally focus on trends over time. So the amount at any given point is less important. However, with an area chart people make synchronously expect the y-axis to start from zero. If you think viewers may be confused by this, you can either modify the axis values in the format section of the visualizations pin or use another visual like a bar chart.

Let's add the region legend back to the chart.

As we mentioned before, this is not the best visual. This is partly because it's difficult to separate the four areas. And partly because two of our lines, the Northeast and South regions cross each other several times.

To address these issues, let's switch to a stacked area chart.

The areas are now stacked on top of each other rather than overlapping as they did on the previous graph.

The number of customers in each region is indicated by the size of the relevant area for any specific month.

For example, while the West region is on top of the chart, it consistently has the smallest area indicating the fewest customers. As we can see when we have multiple lines or lines that cross over each other, the stacked area chart is much easier to read.

Let's stop the lesson here. In the next lesson, we'll look at combining line and bar charts into a single insightful graph.

Dashboards and Visualizations
Introduction to Visualizations in Power BI