Skip to content
Tutorials Center
My learning

Topics

Lesson 41 of 56 ยท Visuals and Reports

The Analytics Pane: Trend Lines, Reference Lines and Forecasts

Use the Power BI Analytics pane: constant, average and percentile lines, trend lines, forecasts with confidence bands and anomaly detection, with Python stand-ins.

A chart shows what happened. The Analytics pane helps you answer the next questions: is that value above target, is the trend going up, what will next quarter look like, and which points are unusual? It is a tab in the Visualizations pane (the magnifying-glass icon) that adds lines and overlays to a chart without writing a single measure.

In this lesson you learn what each overlay does, when it is available, how Power BI's forecast and anomaly detection work in principle, and how to read them critically. The Analytics pane is point-and-click, so the steps are described in words. The runnable examples are Python stand-ins that compute what the overlays compute, so you can see the numbers behind the lines. They use simple, well-known methods, and are not Power BI's own algorithms: the lesson says where they differ.

Where to find it

Select a visual (a line chart is the best one to start with) and open the Analytics tab in the Visualizations pane, next to Build visual and Format visual. Which cards appear depends on the visual:

Overlay Available on What it shows
Constant line most Cartesian charts a fixed value, such as a target of 100,000
Min, Max, Average, Median lines bar, column, line, area, scatter the statistic of the plotted values
Percentile line same visuals a value such as the 90th percentile
Error bars bar, column, line, scatter upper and lower bounds around each point
Trend line line, scatter and clustered column charts with a numeric or date axis a fitted straight line through the points
Forecast line chart with a date or numeric X axis and one series predicted future values with a confidence band
Find anomalies line chart with a date axis highlights unusual points with a suggested explanation
Symmetry shading scatter chart shades the area above or below the diagonal

Each card has an On/Off switch, a color, a line style, a transparency, a label and a position (in front of or behind the data). Add several lines of the same type with Add line, for example a target and a stretch target.

Reference lines

Reference lines give a chart context. A constant line at a goal answers "are we above target" at a glance. Average and median lines show the middle, and a percentile line (for example the 95th) is useful for service levels such as "95 percent of tickets are solved within 4 hours".

A reference line is calculated from the data currently shown. If a slicer filters the chart, the average line moves too. When you need a line that never moves, or a target that varies by month, build a measure instead (for example Target = 100000 or a lookup in a targets table) and add it as a second line series; see Conditional Formatting, KPIs and Cards for target-driven visuals.

Write the meaning in the line's data label ("Target 100K", "Median 58K"), not only in the legend. A line without a label forces readers to guess what it stands for.

Try it: the numbers behind the lines

Python Stand-in: reference lines and a trend line

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The trend line reports a slope of about 2 per month (we generated the data with 2.5; the seasonal wave and the noise pull the estimate down a little) and an R squared that tells you how much of the variation the straight line explains. In Power BI you see the line and can hover for its equation and R squared on some visuals. A trend line is a straight-line fit: it ignores seasonality, so it is a statement about the overall direction, not a prediction of any single month.

Trend lines

Turn the Trend line card on and Power BI draws the best-fitting straight line through the plotted points, using least squares. It works when the X axis is numeric or a continuous date axis. Be careful with these points:

  • With a categorical axis (text), there is no meaningful distance between points, so you cannot add a trend line.
  • If your data has a clear curve or a seasonal pattern, a straight line can mislead. A line through a seasonal series shows the long-term drift, which is fine, but a strong "R squared" does not mean the line predicts a month well.
  • A trend line is a description. It does not say why the numbers move.

The analytics-pane trend line is linear only. If you want a polynomial or logarithmic fit, which suits data that curves or levels off, compute it in a measure or script, or with a Python or R visual, and plot the fitted series as a second line. The stand-in below shows the difference. The same applies to seasonal decomposition, which splits a series into trend, seasonal and remainder parts: Power BI's forecast uses a seasonal model internally, but to show the pieces separately you decompose the series in Python or R and show the parts in a script visual.

Python Stand-in: linear, polynomial and logarithmic trend lines

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The linear line has the lowest fit and also predicts that the series keeps climbing at a steady rate, while the logarithmic curve follows the flattening. A higher R squared on the history is not a promise about the future, so pick the shape from what you know about the process.

Forecasts

On a line chart with a date axis and one measure, the Forecast card extends the line into the future. You choose:

  • Forecast length (in points, months or days) and units.
  • Confidence interval (default 95 percent): the grey band around the forecast. A 95 percent band means that, if the model fits, about 95 out of 100 future values should fall inside it.
  • Seasonality (in points): the number of points in one cycle, for example 12 for monthly data with a yearly pattern, or 7 for daily data with a weekly pattern. Power BI can detect it automatically, but you can set it.
  • Ignore last (points): holds back the most recent points from the model, so you can compare the forecast with what actually happened. This is the built-in way to test a forecast.

Power BI uses exponential smoothing (an ETS model), which weights recent points more than old ones and can model both trend and seasonality. It needs enough history: at least a couple of full seasonal cycles. A forecast does not know about price changes, campaigns, holidays that move, or a pandemic: it extends the pattern.

Try it: forecast, band and a hold-out test

The stand-in uses a simpler method (a straight trend plus a seasonal average) than Power BI's exponential smoothing. The structure of the output is the same: a prediction, a band and a hold-out check.

Python Stand-in: trend plus seasonality forecast with a confidence band

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

If most of the held-back months fall inside the band and the error is small, you can trust the forecast a little. If they do not, the pattern is changing, or there is too little history. In Power BI, set Ignore last to 6 and look at the same comparison on the chart.

A forecast is a projection of the past pattern, not a promise. Always show it with its confidence band, label it as a forecast and do not use it for a decision that needs certainty. The band widens further into the future for a reason: the further out, the less you know.

Anomaly detection

On a line chart with a date axis, the Find anomalies card marks points that are unusual for the pattern around them. A small marker appears on each one. Click it to see the expected range and, if you configured it, possible explanations: Power BI looks at other fields (Explain by) and lists the categories that contributed most to the spike or dip.

The sensitivity slider decides how much a point must deviate to be flagged: high sensitivity flags more points (and more false alarms), low sensitivity flags only extreme ones. The algorithm is Microsoft's own and takes trend and seasonality into account, so a December peak that happens every year is not marked, but an unexpected December dip is.

Try it: flag unusual points

Python Stand-in: anomalies as large residuals

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Months 18 and 29 (the spike and the dip we inserted) are flagged at every sensitivity. Lowering the threshold, which is what raising the slider does, adds borderline months. Choose a sensitivity by looking at what you would be willing to investigate each week.

Explaining what you find

Anomalies and trends tell you what is unusual. To ask why, use the AI visuals in AI Visuals: Key Influencers, Decomposition Tree and Smart Narrative, or add a tooltip page with the breakdown (Drill-through, Tooltips, Bookmarks and Buttons).

Practical advice

  • Use reference lines for goals and context, and measures for targets that vary by period.
  • Use a trend line for direction, and say so in the title ("Revenue is rising by about 2 per month").
  • Use a forecast only with enough history (two or more seasonal cycles) and test it with Ignore last.
  • Treat anomalies as leads to investigate, not as verdicts.
  • Remember that overlays follow the filters: after a slicer change, lines are recalculated.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Which axis does a forecast require?

    Forecasting works on a line chart with a continuous date or numeric X axis and one series.
  2. 2. What does the 95 percent confidence interval around a forecast mean?

    The band expresses the uncertainty of the prediction. It does not state accuracy.
  3. 3. What is the 'Ignore last' option for?

    It is a built-in hold-out test, and the quickest way to judge whether the forecast would have worked.
  4. 4. Your target changes every month. Which is the best way to show it?

    A constant line is one fixed value. A varying target is data, so model it as a measure.
  5. 5. Raising the sensitivity of anomaly detection will usually

    Higher sensitivity lowers the deviation needed to count as an anomaly.

Summary

  • The Analytics pane adds reference lines, error bars, trend lines, forecasts and anomaly detection to a chart without measures.
  • Reference lines are calculated from the visible data; use measures for targets that vary.
  • A trend line is a straight-line fit and ignores seasonality; a forecast extends trend and seasonality with a confidence band and needs a continuous date axis.
  • Use Ignore last to test a forecast, and read anomaly flags as leads, with the sensitivity as your noise control.

Next: AI Visuals: Key Influencers, Decomposition Tree and Smart Narrative.