Power BI Scatter Chart Ratio Line

All posts
Power BI DAX Scatter chart Report design

Power BI Scatter Chart Ratio Line

Adding context to the Power BI scatter chart to help make your visuals tell the story of the data.

The finished Power BI page: a scatter chart with a dotted ratio line through it, two points highlighted blue and one black, beside a card reading 1.19 Ratio and a table listing X, Y, X Ratio Line Position and Above or Below Ratio Line for categories A, B and C.

The Scatter Chart in Power BI has various analytical features that can be added to the visual.

The main drawback in using them is that the report creator, and report user isn’t able to see the values produced by them nor the statistical calculations that are being used in the backend to create the output.

This can cause an issue if questions arise when the report user may question the validity of the statistical analysis being done on a visual. So in order to ensure that we avoid any awkward conversations relating to any given statistical analysis provided, we need to ensure that we fully understand and provide the report user with the requisite information relating to any analysis provided along with the visual created.

One such example of this is the scatter plot’s ratio line.

Let’s take for example the very simple dataset as is shown below.

The Power Query preview of the source table: three columns, Category, X and Y, with rows A 4 5, B 5 6 and C 7 8.
Three categories, an X value and a Y value. That is the whole model.

In a Power BI scatter plot the chart looks like this:

A plain Power BI scatter chart with three labelled points, A at 4 and 5, B at 5 and 6, C at 7 and 8, and no analytics lines.
The scatter chart with nothing added to it.

Our visual could definitely use some sprucing up, let’s provide the report users with a bit of context by showing which values are above or below the average.

In the Scatter Chart Analytics menu, and add a ratio line.

The Visualizations Analytics pane for a scatter chart, listing Trend line, X-Axis Constant Line, Y-Axis Constant Line, Min line, Max line, Average line, Median line, Percentile line, Symmetry shading and Ratio line, with Ratio line switched On and its Color, Transparency, Line style and Width settings expanded.
Ratio line, switched on in the Analytics pane.

The Ratio Line is shown as follows.

The same scatter chart with a dotted ratio line running up through the three points from the bottom left of the plot area.
The ratio line, drawn but unlabelled. No number anywhere on the visual.

Now let’s define a ratio line

The ratio line is a straight line that starts from the origin (0,0) and extends outwards. Its slope is determined by the overall relationship between the total sum of values on the Y-axis and the total sum of values on the X-axis for all the data points displayed in the scatter plot.

Essentially, it visually represents the average ratio of the Y-axis measure to the X-axis measure across all plotted categories.

As stated earlier, this is all well and good but how do we check that Power BI has calculated this right and how can we show these values in a visual (table etc) if it’s requested? The last thing we want is to be quizzed about “that line in the scatter plot” in a meeting and we can’t accurately provide an answer (because that’d be awkward, wouldn’t it?).

Even if it’s not a requirement of the report it’s still a good idea to check that the calculation is being done correctly in Power BI; doing this also gives you confidence in knowing more about the Ratio Line, rather than just blindly adding to your chart.

This will also allow us to include the ratio line values in our tooltip and even provide above/below values to the tooltip also so the report user can tell exactly how close to the average each data point is.

Let’s now cut to a nice little snippet generated by my good friend Gemini to describe how we calculate the line.

The slope of the ratio line written out: k equals the sum of all Y values divided by the sum of all X values, so the line is Y equals kX. For this data the sums are 19 and 16, giving a slope of 1.1875.
The slope is the sum of Y over the sum of X. Here that is 19 over 16, or 1.1875.

Showing the calculations in Power BI

For this we need some basic DAX, a sum of each column (X and Y) and a basic calculate statement to give us the total of each column ignoring the row context of each category.

From this we can work out our Ratio amount and then the ratio value for each category, followed by the variance of each category value to the ratio line.

Sum X = SUM ( Data[X] )

Sum Y = SUM ( Data[Y] )

Sum X ALL = CALCULATE ( [Sum X], ALL ( Data[Category] ) )

Sum Y ALL = CALCULATE ( [Sum Y], ALL ( Data[Category] ) )

Ratio = DIVIDE ( [Sum Y ALL], [Sum X ALL] )

Ratio Line X Position = [Sum X] * [Ratio]

Above or Below Ratio = [Sum Y] - [Ratio Line X Position]

Above or Below Ratio Colour = IF ( [Above or Below Ratio] > 0, "#118DFF", "#000000" )

Let’s put this all together in a visual and add the values in a card and table for context. Also, let’s highlight when a data point is above average to make it visually obvious.

The finished page: the scatter with its ratio line, A and B drawn in blue because they sit above the line and C in black because it sits below, a card showing the ratio of 1.19, and a table giving each category its X, Y, X Ratio Line Position and Above or Below Ratio Line value.
The line, the number behind it, and the variance for every point.

And there we have it! Looking pretty good I’d say.

If you’d like to check the finished product in a pbix file, see my Github here:

Y Axis Ratio.pbix, the finished file github.com/InsightfulAnalytics/PBI-Files

If you would rather read about colour than analytics lines, the piece on storing hex codes in measures covers the trick used above to turn the above and below points different colours.

This article was first published on my Substack in May 2025. I no longer post there, so it lives here now.

Need the numbers behind the visual?

Analytics lines are the easy half. If the model underneath them needs work, that is what I do for a living.

BiNexus

Power BI specialist & CPA. Building data solutions that translate complexity into decisions.

Connect

LinkedIn GitHub
© 2026 BiNexus · Timothy Osborn Built with Power BI & care