Forum Discussion
Scatter Chart | Slope, Intercept, R-Square | Power BI
- 9 months ago
Hi BhanumathiSivan ,
Thanks for reaching out to Microsoft Fabric Community.
Since you’re using Field Parameters to allow users to select columns dynamically, the behavior with LINESTX is expected because the function requires fixed column references and doesn’t support parameter-driven fields directly. One approach is to reshape the data model so that the selected attributes are stored in consistent columns such as ValueX and ValueY, which can then be used in regression calculations.
After that, you can apply LINESTX over the filtered table where AttributeX and AttributeY correspond to the selected parameters using SELECTEDVALUE from the slicers. If LINESTX still doesn’t return results due to context issues, slope and intercept can be calculated manually using SUMX and AVERAGEX over the filtered data.
For Reference:
LINESTX function (DAX) - DAX | Microsoft Learn
Similar discussions: Solved: Trend line - R2, slope and interception - Microsoft Fabric Community
Solved: LINESTX - not able to see the intercept and slop... - Microsoft Fabric Community
Solved: LINESTX with slicer - Microsoft Fabric CommunityHope this helps. Please reach out for further assistance.
Thank you.
- 9 months ago
Please check if the attached PBIX file gives you the values you need when you change the slicers.
Hi BhanumathiSivan ,
Thanks for reaching out to Microsoft Fabric Community.
Since you’re using Field Parameters to allow users to select columns dynamically, the behavior with LINESTX is expected because the function requires fixed column references and doesn’t support parameter-driven fields directly. One approach is to reshape the data model so that the selected attributes are stored in consistent columns such as ValueX and ValueY, which can then be used in regression calculations.
After that, you can apply LINESTX over the filtered table where AttributeX and AttributeY correspond to the selected parameters using SELECTEDVALUE from the slicers. If LINESTX still doesn’t return results due to context issues, slope and intercept can be calculated manually using SUMX and AVERAGEX over the filtered data.
For Reference:
LINESTX function (DAX) - DAX | Microsoft Learn
Similar discussions: Solved: Trend line - R2, slope and interception - Microsoft Fabric Community
Solved: LINESTX - not able to see the intercept and slop... - Microsoft Fabric Community
Solved: LINESTX with slicer - Microsoft Fabric Community
Hope this helps. Please reach out for further assistance.
Thank you.
- v-veshwara-msft9 months agoCommunity Support
Hi BhanumathiSivan ,
Just wanted to check if the response provided was helpful. If further assistance is needed, please reach out.
Thank you.- v-kpoloju-msft9 months agoCommunity Support
Hi BhanumathiSivan,
Just wanted to follow up. If the shared guidance worked for you, that’s wonderful hopefully it also helps others looking for similar answers. If there’s anything else you'd like to explore or clarify, don’t hesitate to reach out.Thank you.