问题
Is there a simple way to caclulate the R^2 value in a Power Pivot? In 'normal' excel, we can use the RSQ function but that function doesn't exist among the Measure functions in Power Pivot.
回答1:
Short answer: No. There's no native DAX equivalent of the Excel RSQ function.
You could create DAX calculations to determine the Pearson correlation (example) or you could use R script (example)
回答2:
As @Olly says, there isn't a built-in equivalent but the formula is not too difficult to write yourself.
Correl =
VAR AvgX = AVERAGE ( Table1[x] )
VAR AvgY = AVERAGE ( Table1[y] )
RETURN
DIVIDE (
SUMX ( Table1, ( Table1[x] - AvgX ) * ( Table1[y] - AvgY ) ),
SQRT (
SUMX ( Table1, ( Table1[x] - AvgX ) ^ 2 ) *
SUMX ( Table1, ( Table1[y] - AvgY ) ^ 2 )
)
)
来源:https://stackoverflow.com/questions/57802291/r-squared-as-measure-in-excel-power-pivot