I've been trying to incorporate LINESTX into my reporting but keep running into errors when modifying the filter context.
To create a minimal reproducible example, I've loaded a data table like...
Daniil
Kudo Kingpin
3 years agoAlexisOlson, while we're waiting for the June release of Power BI Desktop, here's a workaround -- use TOPN:
LINEST_Intercept Daniil =
VAR Summary =
ADDCOLUMNS (
VALUES ( Data[ID] ),
"@Y", CALCULATE ( SUM ( Data[Y] ) ),
"@X1", CALCULATE ( SUM ( Data[X1] ) ),
"@X2", CALCULATE ( SUM ( Data[X2] ) )
)
VAR Coeffs = LINESTX ( Summary, [@Y], [@X1], [@X2] )
VAR Intercept = SELECTCOLUMNS ( TOPN ( 1, Coeffs ), [Intercept] )
RETURN
Intercept