Data

# Questions from Tableau Training: Combining Measures into a Single Line

Our Certified Tableau Trainers are asked a myriad of questions each day. In this series, they share some answers.

Time for another question from Tableau Training, this time a question asked by Daniel from a DII: Intermediate course in Kuala Lumpur, Malaysia:

“I want to show my actual sales on a line graph, but I also want to combine that to show budgeted sales after today’s date.”

Let’s put on our crime solving hat and solve this very interesting question.

## The Calculation

This is doable. We just need to set up our calculation first. I’m going to use some made-up data that has monthly sales as [Sales] in one column and budgeted sales as [Budget Sales] in another. Here’s our initial calculated field to combine the two measures together:

Now let’s create another field that we can use for our formatting:

We are wrapping this calculated field in the ATTR function so that it doesn’t create two discrete lines when we drop this onto the color button. Instead, it will create a gradient color change between the two data points for actual and budgeted sales.

## Build the Viz

Let’s build our view by putting our Sales Actual & Budgeted measure on Rows along with the date value of month (i.e., continuous) on columns. Next, let’s put our Sales Designation on the Color button to get the following:

And here’s how we are setting up our tooltips:

Our Sales Designation field will automatically adjust the tooltip label depending on where we look on our number line:

We can do more. Let’s make our field labels also dynamic for whether the line is showing actual or sales, and let’s also include conditional formatting for that. I’ll need a new calculated field for each label. First, actual sales:

Next, budgeted sales:

Now, drop both on the Labels button and then format like so:

We have a lot of points of data on our view, 41 to be precise. So, I think it’s best we label our line ends to keep our visualization as simple as possible. Here’s what we end up with:

Thanks, Daniel, for the great question! Keep them coming!

## Robert Curtis

Virtual Event Recap: Deep Dive of Tableau Parameters For our June Lunch and Learn, we did a deep dive on parameters for our friends across Australia and Singapore. Tableau is the premier ...
Virtual Event Recap: Tableau’s Performance Recorder We’ve already spent some time talking about how to optimize your Tableau workbooks for best performance in previous webinars. This ...

See more from this author →

• I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
• This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072