Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
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
DateTime | Type | Reading |
Feb 3 12PM | Speed | 100 |
Feb 5 9PM | Speed | 80 |
Feb 7 8PM | Temp | 45 |
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.
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
Hope this video helps with the concept:
Thank you. I already understand the concept. I had very specific questions about how to structure the data.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.