Forum Discussion
james_pease
4 years agoHelper III
Regression Formula
Hello all, I need help with the following error: The syntax for ',' is incorrect. (DAX(VAR KnownX = AllSelected( 'All_Actual_Sales (3)', 'All_Actual_Sales (3)'[LN(x)])VAR KnownY = ALLSELECTED ( 'A...
james_pease
4 years agoHelper III
Ok so I think I have most if it right except the selectcolumns again,
Logarithmic regression =
VAR Known =
FILTER (
SELECTCOLUMNS (
ALLSELECTED ( 'All_Actual_Sales (2)'[Actual Sales Null Values], 'All_Actual_Expenses (2)'[Cost % Column] ),
"Known[X]", [Actual Sales Null Values],
"Known[Y]", [Cost % Column]
),
AND (
NOT ( ISBLANK ( Known[X] ) ),
NOT ( ISBLANK ( Known[Y] ) )
)
)
VAR Count_Items =
COUNTROWS ( Known )
VAR Sum_X =
SUMX ( Known, Known[X] )
VAR Sum_X2 =
SUMX ( Known, Known[X] ^ 2 )
VAR Sum_Y =
SUMX ( Known, Known[Y] )
VAR Sum_XY =
SUMX ( Known, Known[X] * Known[Y] )
VAR Average_X =
AVERAGEX ( Known, Known[X] )
VAR Average_Y =
AVERAGEX ( Known, Known[Y] )
VAR Slope =
DIVIDE (
Count_Items * Sum_XY - Sum_X * Sum_Y,
Count_Items * Sum_X2 - Sum_X ^ 2
)
VAR Intercept =
Average_Y - Slope * Average_X
RETURN
SumX(
Distinct (All_Actual_Sales[Actual Sales Null Values]),
Intercept + Slope * All_Actual_Sales[Actual Sales Null Values]
)
Error: All column arguments of the ALL/ALLNOBLANKROW/ALLSELECTED/REMOVEFILTERS function must be from the same table.
In this case do I simply remove ALLSELECTED?
In this case do I simply remove ALLSELECTED?