2023 Week 07 | Power BI: Non-linear Regression


This week for Workout Wednesday we will be trying our hand at non-linear regression with the Deneb custom visual.

With Vega and Vega-Lite we can create a non-linear line of best fit over our data points and utilise the statistical API to return a correlation coefficient.


Power Query
  1. Obtain the dataset from the Data Stories Gallery
  2. Model and load data
Power BI Desktop


  1. Import Deneb Custom Visual found in AppSource
  2. Place fields in Field Well
  3. From the ellipsis of the custom visual header, select edit visual
  4. Visit Regression | Vega-Lite for guidance
  5. Create a new Vega-Lite Specification
  6. Create a scatter chart of mark type = point with ‘power’ and ‘shot put distance’ encoded on the x and y axes respectively
  7. Layer a line with a linear regression transform
  8. Layer a text mark with the correlation coefficient
  1. Repeat the Linear Regression
  2. Change the regression method to quadratic for the line: “transform”: [ {
    “regression”: “Power”,
    “on”: “Shot putt distance”,
    “method” : “quad”
  3. Change the regression method to quadratic for the text: “transform”: [{
    “regression”: “Power”,
    “on”: “Shot putt distance”,
    “params”: true,
    “method” : “quad”
    {“calculate”: “‘R²: ‘+format(datum.rSquared, ‘.2f’)”, “as”: “R2”}
  1. Repeat the Linear Regression
  2. Try adjusting the extent of the lines
  3. Try out other regression types such as polynominal with orders 2, 3 and 4
  4. Polynomial Regression: The Only Introduction You’ll Need | by Aden Haussmann | Towards Data Science
1. Try recreating these regression graphs with Vega


The dataset this week can be viewed here


After you finish your workout, share on Twitter using the hashtags #WOW2023 and #PowerBI, and tag @MMarie, @shan_gsd, @KerryKolosko. Also make sure to fill out the Submission Tracker so that we can count you as a participant this week in order to track our participation throughout the year.


Solution File available for download via Data Stories Gallery

2 thoughts on “2023 Week 07 | Power BI: Non-linear Regression”

  1. Hi,
    I think the regression should be the other way around? as power is the cause (independent variable) and shot the dependent variable?

Comments are closed.

Scroll to Top