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?
  38. Questions from Tableau Training: Down the Aggregation Rabbit Hole
  39. Questions from Tableau Training: Percent Change from Previous Period on a Map
  40. Questions from Tableau Training: Union File Names as Years
  41. Questions from Tableau Training: Conditional Coloring on Sparklines
  42. Questions from Tableau Training: Moving Column Headers to the Top of the View
  43. Questions from Tableau Training: Isolating Rank with Parameters and Calculations

More About the Author

Robert Curtis

Managing Director, APAC
Kickstarting Data Innovation in Healthcare On 13 March 2024, InterWorks was a proud Platinum sponsor of the first ever Data & Analytics in Healthcare conference, hosted by ...
Building Solutions with InterWorks at Corinium’s Data Architecture Conference in Melbourne InterWorks was a proud sponsor of the Data Architecture Conference hosted by Corinium in Melbourne on 21 and 22 June 2023. Hundreds of ...

See more from this author →

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

×

Love our blog? You should see our emails. Sign up for our newsletter!