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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
bvy
Helper V
Helper V

Fun with the new LINEST / LINESTX DAX Functions...

I love these functions and hope to leverage them to get the slope of a best fit line over a series of data. My data table looks like this: 

 

Table1

DateTimeTypeReading
Feb 3 12PMSpeed100
Feb 5 9PMSpeed80
Feb 7 8PMTemp45

Etc. 

 

Now I can write this DAX function to give me the slope (and other stats) of the best fit line for Speed. 

 

 

SELECTCOLUMNS(LINESTX(FILTER(Table1, Table1[Type] = "Speed"), Table1[Reading], Table1[DateTime]), "Slope", [Slope1])​

 

 

Okay, first of all, that returns a table with a single rown and single column, but it's still a table. How can I convert that to a scalar value without resorting to variables? 

 

Second, and more importantly, do you see an easy way for me to get slope values for EVERY Type (Speed. Temperature, etc.) without having to hard code each one in its own measure?  

 

Thanks. 

3 REPLIES 3
LJ_Energy_Eng
New Member

I am a bit unsure of what you are looking for. This guide uses FIRSTNONBLANK to retrieve the value from the table returned by LINEST, to make an estimation: Multiple Linear Regression in Power BI - Ben's Blog

Padycosmos
Solution Sage
Solution Sage

Hope this video helps with the concept:

https://www.youtube.com/watch?v=y42j0hpcFRc

Thank you. I already understand the concept. I had very specific questions about how to structure the data. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.