Questions from Tableau Training: Combining Measures into a Single Line

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:

Sales Actual & Budgeted calculation

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

Formatting field

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:

First Tableau view

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

Edit Tooltip

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

Adjusting tooltip

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:

Sales Label calculation

Next, budgeted sales:

Budget Sales Label

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

Edit Label

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:

Final Tableau view

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

Want more Questions from Tableau Training

  1. Questions from Tableau Training: Quick Filter Interaction
  2. Questions from Tableau Training: Labeling with Table Calculations
  3. Questions from Tableau Training: Speeding Up Presentation Views when Using Tableau
  4. Questions from Tableau Training: Dashboard Actions
  5. Questions from Tableau Training: Business Day Calculations
  6. Questions from Tableau Training: Adding Gaps Between Bars
  7. Questions from Tableau Training: When to Pivot Data in Tableau
  8. Questions from Tableau Training: Adding Conditional Formatting
  9. Questions from Tableau Training: Setting Weekday Start
  10. Questions from Tableau Training: How Do ZIP Codes Work in Tableau?
  11. Questions from Tableau Training: The Small Grey Bar Within a Quick Filter
  12. Questions from Tableau Training: Matching Mark Color
  13. Questions from Tableau Training: Showing the Null Indicator
  14. Questions from Tableau Training: Can I Manually Set the Colors of a Stepped Gradient?
  15. Questions from Tableau Training: How Can I Get Box Plot Data into a Crosstab?
  16. Questions from Tableau Training: How Do I Clear a Worksheet? Make a Copy?
  17. Questions from Tableau Training: Opening URL Actions Inside of a Dashboard
  18. Questions from Tableau Training: Can I Move Mark Labels?
  19. Questions from Tableau Training: How Can I Use My Current Report to Create a Viz?
  20. Questions from Tableau Training: Can I Create Text Hyperlinks on a Dashboard?
  21. Questions from Tableau Training: How Can I Transform My Crosstab into a Flat List?
  22. Questions from Tableau Training: Labeling the Top N
  23. Questions from Tableau Training: How Can I Customize Charts with Parameters?
  24. Questions from Tableau Training: Combining Measures into a Single Line
  25. Questions from Tableau Training: How Can I Create Custom Color Palettes?
  26. Questions from Tableau Training: Can a Top N Parameter be Nested Within Other Fields?
  27. Questions from Tableau Training: Conditional Scope on Tableau Calculations
  28. Questions from Tableau Training: Top Ten Plus N
  29. Questions from Tableau Training: Dynamic Label Positioning
  30. Questions from Tableau Training: Using Cross Joins to Solve Active Tickets
  31. Questions from Tableau Training: Top N Highlight Table
  32. Questions from Tableau Training: How to Use Specific Dimensions in Table Calculations
  33. Questions from Tableau Training: Moving Reference Line Labels
  34. Questions from Training: Comparing Metrics for Same Weekday in Previous Year
  35. Questions from Tableau Training: Colouring Specific Columns and Rows in a Crosstab
  36. Questions from Tableau Training: Creating a Custom Legend as a Sheet
  37. Questions from Tableau Training: How Can I Draw a 45-Degree Angle?

More About the Author

Robert Curtis

Analytics Consultant
An Interactive Guide to Public Toilets in Australia Traveling requires planning. Where do you want to go? How will you get there? Where will you stay? What will you eat? These are the ...
Tableau Desktop Now Available in Dothraki With aims to broaden their global customer base, Tableau Software (NYSE: DATA) announced today a Dothraki language version. The ...

See more from this author →

Subscribe to our newsletter

  • This field is for validation purposes and should be left unchanged.