LINESTX DAX Function (Statistical)

Uses the Least Squares method to calculate a straight line that best fits the data, then returns a table describing the line. The data result from expressions evaluated for each row in a table.

Syntax

LINESTX ( <Table>, <ExpressionY>, <ExpressionX> [, <ExpressionX> [, … ] ] [, <Const>] )
Parameter Attributes Description
Table
Iterator

The table containing the rows for which the expressions will be evaluated.

ExpressionY
Row Context

The expression to be evaluated for each row of the table, to obtain the known y-values.

ExpressionX
Row Context
Repeatable

The expressions to be evaluated for each row of the table, to obtain the known x-values.

Const Optional

A constant TRUE/FALSE value specifying whether to force the constant b to equal 0. If true or omitted, b is calculated normally. If false, b is set to 0.

Return values

The table returned has the following columns:

  • SlopeN (one for each X expression)
  • Intercept
  • StandardErrorSlopeN (one for each X expression)
  • StandardErrorIntercept
  • CoefficientOfDetermination
  • StandardError
  • FStatistic
  • DegreesOfFreedom
  • RegressionSumOfSquares
  • ResidualSumOfSquares
» 1 related article

Examples

DEFINE
TABLE Test = 
    SELECTCOLUMNS ( 
        {
	        ( 2310, 2, 2, 20, 142000),
	        ( 2333, 2, 2, 12, 144000),
	        ( 2356, 3, 1.5, 33, 151000),
	        ( 2379, 3, 2, 43, 150000),
	        ( 2402, 2, 3, 53, 139000),
	        ( 2425, 4, 2, 23, 169000),
	        ( 2448, 2, 1.5, 99, 126000),
	        ( 2471, 2, 2, 34, 142900),
	        ( 2494, 3, 3, 23, 163000),
	        ( 2517, 4, 4, 55, 169000),
	        ( 2540, 2, 3, 22, 149000)
	    },
	    "Floor space (x1)", [Value1],
	    "Offices (x2)", [Value2],
	    "Entrances (x3)", [Value3],
	    "Age (x4)", [Value4],
	    "Assessed value (y)", [Value5]
    )
EVALUATE
Test

EVALUATE
LINESTX (
    Test, 
    Test[Assessed value (y)], 
    Test[Floor space (x1)],
    Test[Offices (x2)],
    Test[Entrances (x3)],
    Test[Age (x4)]
)
Floor space (x1) Offices (x2) Entrances (x3) Age (x4) Assessed value (y)
2,310 2 2.00 20 142,000
2,333 2 2.00 12 144,000
2,356 3 1.50 33 151,000
2,379 3 2.00 43 150,000
2,402 2 3.00 53 139,000
2,425 4 2.00 23 169,000
2,448 2 1.50 99 126,000
2,471 2 2.00 34 142,900
2,494 3 3.00 23 163,000
2,517 4 4.00 55 169,000
2,540 2 3.00 22 149,000
Slope1 Slope2 Slope3 Slope4 Intercept StandardErrorSlope1 StandardErrorSlope2 StandardErrorSlope3 StandardErrorSlope4 StandardErrorIntercept CoefficientOfDetermination StandardError FStatistic DegreesOfFreedom RegressionSumOfSquares ResidualSumOfSquares
27.64 12,529.77 2,553.21 -234.24 52,317.83 5.43 400.07 530.67 13.27 12,237.36 1.00 970.58 459.75 6 1,732,393,319.23 5,652,135.32

Related articles

Learn more about LINESTX in the following articles:

Last update: Oct 3, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://learn.microsoft.com/dax/linestx-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of LINESTX? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.