Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Torbenan
Helper I
Helper I

Linear Regression

Hi

I've got a table like this

 

year    Sales

2012  10

2013  12

2014  13

2015  13

2016  16

2017  15

2018  17

In can put this in to a Line Chart Visual and a Trend Line. This will show me the Sales Trend. I want to find the slop of the trend line by using a linear regression in DAX. How do I do that?
It's very simple in Excel

 

 

 

3 REPLIES 3
jdbuchanan71
Super User
Super User

Hello @Torbenan 

Take a look at this excellent post by Daniil Maslyuk. https://xxlbi.com/blog/simple-linear-regression-in-dax/

 

Thank - that seems to be the way to go. Just wonder, why this i so simple in Excel (=LINREGR(B3:B9;A3:A9)) and so complicated in Power Bi

 

Because Excel is 25 years older than DAX. Smiley Happy  They add new features every month so you may see something like LINREGX(table,expression) in the future.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.