# Exercise: Make a Line Graph with Continuous Quarters in Tableau

Ryan Sleeper

### SUM Quantity by Segment and Continuous Quarter

In this self-guided exercise, you will use what you’ve learned about discrete vs. continuous fields and how to visualize trends in Tableau to make your first line graph.

Hi. This is Ryan with Playfair Data TV. And in this exercise, we’re going to make this line graph that looks at sum of quantity by continuous quarters. So I just want to point out a couple of things with this one before you pause the video and attempt to recreate this line graph. I would start with my measure of quantity, and then I would break it down by a continuous quarter, which is going to give me the foundational line graph.

From there, we’ve also got a column for each segment. So that keyword of column should tell you where to put the segment dimension. And we’re also coloring these lines by segment. So take a shot at that. Pause the video. I’ll come back in just a moment and show you how this was built.

All right we’re now going to recreate that line graph. See if you got it. And I’ll show you my preferred method. I always start with my measures. So I’m just going to double click on Quantity to get it onto the view. The default behavior is for Tableau to draw a row with the measure that we clicked on, which is exactly what I wanted. I wanted a y-axis for quantity. So so far, so good.

The order doesn’t matter too much. But I prefer to go ahead and lay the foundation for one line graph and then add context to that line graph. So I’m going to start to convert this bar chart to a line graph by adding some element of time. This is another application of one of my favorite shortcuts, which is if you right-click on your element of time and drag it to the columns shelf, you’ll get to choose both the date part, as well as if that date’s being used as discrete or as continuous.

That allows me to make these choices before Tableau draws anything on the view. It can get kind of confusing if you forget this and you add a date but then you need to figure out how to change it later on. So I prefer that shortcut of right-clicking, dragging it to the columns shelf, then I just get to choose those things before it draws anything.

The option that I’m looking for is the quarter date part with the green icon next to it, which tells me it will be used as continuous. So I’m going to choose Quarter with the green calendar icon next to it. Click OK. That gets me this one foundational line graph.

But we are also going to break this down further by a dimension called “segment.” Segment was drawing a column for each of our three segments. So that word column is a key word on where to put that dimension of segment. I’m going to drag segment to the columns shelf, which will give me three different columns instead of one.

Then we’re also coloring the marks by segment. There’s only one way to color marks on the view, and that’s to put something onto the color marks card. We can either drag segment to Color, or I’ll undo that, you could hold down Control, drag segment to Color, and it’ll create a copy of that pill.

One last thing. You might have noticed there was a small circle on each data point. Those are called “markers.” If you want to add that marker effect, it lives on the Color Marks card. And if you click Color. Under Effects, it’s the second option, Markers. If you choose that option in the middle, it’ll add a small circle to every data point.

This has two purposes. One is aesthetics. I think it just looks a little bit nicer, gives it a tiny bit of professional polish. But it also has a practical purpose of showing you where there’s a data point. For example, from here to here. If I didn’t have markers on the view, I wouldn’t know whether or not there was a marker or a data point between here and here.

Let me give you another example where there actually is a marker. So from here to here. If we didn’t have markers, this trend goes in almost a perfect vertical trend here. It’s a perfect diagonal line. I wouldn’t know for sure that there was a data point here until I added the markers. So they also serve a practical purpose. This has been the exercise on how to make a line graph in Tableau.

I’m Ryan with Playfair Data TV – thanks for watching!