Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power BI: Add a Horizontal Line to a Chart

· 8 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Power BI desktop does not have a one-click "horizontal line to show" menu item. The reliable way to add a horizontal line to a chart is to create a one-row table or measure that holds the value you want the line to represent, such as a target, an average or a budget, and then add it to the chart as an extra series. The line then sits at a constant Y value across every X category, which is exactly what a reference line does. There are two practical routes: a calculated table added to the chart, which works in every visual and keeps the line in the tooltip and legend, or a constant line drawn on the axis in the Analytics pane, which is faster but only exists for certain visuals such as line, column, bar, area and combo charts. This guide walks through both, with the table method first because it is the most durable.

What You'll Need

  • A Power BI Desktop report that already has a chart driven by a date or category axis and a numeric value.
  • A field, measure or fixed number you want the line to represent, for example a sales target or a company-wide average.
  • The report open on the Report View canvas so the Visualizations and Fields panes are visible.
  • Roughly a minute, plus a willingness to change one line's chart type after adding it.

Step-by-Step

Method one uses a target table and works in any chart that accepts a field on the Values well. Menu labels can differ slightly by version, device or region, so read the descriptions as well as the exact wording.

  1. Click an empty area of the Report View canvas so no visual is selected, then open the Home ribbon and choose Enter data. In older versions the same command sits under Modeling.
  2. In the table that opens, replace Column1 with a name such as Target and put your value in the first row, for example 150000. Rename the table itself in the Name box to something clear like Sales Target, then click Load.
  3. Confirm the new table appears in the Fields pane. If it does not, right-click the Fields pane and refresh it.
  4. Select your chart so the Visualizations pane shows what is currently on each well.
  5. Drag the numeric column from your new table, for example Sales Target[Target], into the Values well, next to the existing measure. The chart now shows a second series, but it may appear as another bar or column rather than a line.
  6. Change that series' chart type. In Power BI Desktop, right-click the visual and choose Change visual type, or use the combo chart option that appears when multiple values are present. Assign the first value to Column (or Line) and the second value to Line.
  7. With the combo chart in place, select the secondary line and check that it reports on the same Y-axis scale as the original series. If the target is far larger or smaller than the values, Power BI may split them onto two axes and the line will look like it is floating at the wrong height.
  8. Format the line so it reads as a reference marker rather than data: open the Format pane, find the Lines section for that series, and set the color to something contrasting, reduce the stroke width slightly, and switch on the dashed style. Turn off markers if they clutter the view.
  9. Give the line a legend name. Rename the value in the Fields pane by double-clicking it, for instance to Target, so the legend reads clearly instead of showing a generic table column name.
  10. If you want the line to sit behind the actual data, use the Format pane Data colors area or the line's own layer setting where available, and reduce its transparency slightly.

Method two is the quick route using the Analytics pane. It does not require any new table and can be added in seconds, but the line is not part of the data model, so it will not appear in tooltips as a named series and it is lost if you switch to a visual type that does not support it.

  1. Select the chart on the canvas.
  2. Open the Visualizations pane and click the Analytics icon (it looks like a small magnifying glass over a bar chart).
  3. Expand the Constant line section, then click Add line.
  4. In the constant line settings, choose whether the line applies to the X-axis or the Y-axis. For a horizontal reference line across a vertical column or line chart, choose the Y-axis.
  5. Enter the value, choose the color, line style and transparency, and optionally add a data label so the value is visible on the chart.
  6. Repeat Add line for each additional threshold, for instance an upper and lower limit.

If the Analytics pane shows no Constant line option, or the section is greyed out, the current visual type does not support it. Switch to a line, column, bar, area or combo chart, or fall back to method one.

Common Mistakes

  • Adding the target to the Legend well instead of Values. The legend only splits existing data into categories; it does not create a new series.
  • Leaving the line on a secondary axis. A target drawn against a different scale will sit at the wrong visual height and mislead readers. Check the axis assignment before formatting anything.
  • Putting the numeric value in a text column. Enter data loads anything you type as a number only if the whole column is numeric, so a stray character turns the column into text and it cannot be plotted.
  • Using a card or a text box to show the target while still expecting a line on the chart. Those visuals do not affect the chart at all.
  • Forgetting that an average line moves with the filter context. If you base the line on a measure such as an average, it will recalculate per slice or per filter, which is sometimes intended and sometimes not.
  • Changing the whole visual to a line chart, which converts the actual columns to lines too. Use the combo option and set only the second value to Line.

Tips

  • If the line needs to be horizontal across time but your visual is a scatter chart, use a measure and add it to the X or Y well rather than trying to force a constant line.
  • For a target that changes over months, build a small table of year-month and target values and relate it to your date table. The line will then step up or down instead of staying flat.
  • Name the line series clearly, something like Target or Budget, and keep the wording consistent everywhere the report appears.
  • Use a dashed, slightly transparent line so viewers read it as a reference and not as another data series.
  • Keep the line colour consistent across pages so readers learn what it means after the first look.
  • Add a card that shows the gap between the actual and the target, because a line alone does not tell people how far short they fell.

Troubleshooting

If the line does not appear at all, check that you added a value and not a blank column. A measure returning blank for the current filter context draws nothing, and a constant line set to a value outside the axis range can be invisible. Widen the axis range or lower the line value and it will show.

If the line appears at the top or bottom of the chart and seems unrelated to the data, suspect a secondary axis or a text-typed column. Right-click the axis and inspect the scale, and confirm the column icon in the Fields pane shows a numeric type rather than a text symbol.

If the chart throws an error after adding the series, the most likely cause is a mismatch between a date axis and a target table with no relationship. Either remove the relationship dependency and use a constant line, or create a proper date table and relate both tables to it.

If your publishing step fails or the line disappears in the Power BI service, check that the visual type you used is supported in the browser version and that the semantic model was refreshed after you added the target table. A visual that relies on a custom visual can also render differently outside Desktop, so test the page after publishing.

If you changed something and want a clean start, remove the extra series from the Values well and delete the helper table from the Fields pane. Deleting a table is permanent, so make sure nothing else in the report uses it first.

Frequently Asked Questions

Can I add a horizontal line without creating a new table?

Yes. Use the Analytics pane's Constant line on a supported visual such as a line, column, bar, area or combo chart. It is faster, but the line is a visual property rather than data, so it will not show in tooltips as a series and will not survive a visual type change that does not support it.

Why is my target line slanted instead of flat?

A horizontal line means one constant Y value for every X category. If it slants, either the series is tied to a changing field, or the visual has sorted or filtered the categories in a way that pairs different values. Use a fixed value or a single-row table for a truly flat line.

Can I show an average line that changes with filters?

Yes. Create a measure that calculates the average over the current filter context and add it to the Values well, then set that series to Line in a combo chart. It will recalculate as filters change, which is usually what people want for a moving benchmark.

Does the constant line work in every chart type?

No. It is limited to chart types with a continuous or categorical axis. Pie, donut, treemap and card visuals do not offer it. If the option is greyed out, switch the visual type or use the target table method instead.

Can I add more than one horizontal line?

Yes. Add extra columns to the helper table, one per threshold, and put each on the Values well, or use Add line repeatedly in the Analytics pane. Multiple lines are useful for upper and lower limits, but keep the count small enough that the chart stays readable.

Will the line show in the tooltip?

With the table method, yes, because the line is a real series. With the Analytics constant line, usually no, since it is a formatting element. If the tooltip value matters, use the table approach.