Search
  • Robert Breen

Tableau: How to create a Side by Side Bar Graph with Overlaying Line Chart

Updated: May 14




Step 1:

Select all of your metrics. Right click one of them. Select Transform > Pivot. This will give you pivot field names and pivot field values.





Step 2:

Create this calculated field for your bar values.

If [Metric] = “Metric1” or [Metric] = “Metric2” then [Value] end





Step 3:

Create this calculated field for your line values.

If [Metric] <> “Metric1” and [Metric] <> “Metric2” then [Value] end





Step 4:

Create a dual axis chart with [Bar values], [Line Values], and [Date].





Step 5:

To separate the stacked bar chart, use this calculation on the columns shelf.

If [Metric] = “Metric2” then month([Date])+.5 else month([Date]) end





Step 6:

Add color and set as dual axis.







100 views0 comments