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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors