Forum Discussion
nufffins
3 years agoFrequent Visitor
Slope from LINEST as new column
Hi! I need help with creating a new column in PowerBI. My data has columns for type, time and result and I need to calculate the rate for the result in new column. This is outtake fr...
lbendlin
3 years agoSuper User
This works:
LINEST A =
var a = max('Table'[Time])
var b = TOPN(5,CALCULATETABLE('Table','Table'[Time]<=a),[Time],DESC)
var c = LINESTX(b,[Time],[A])
return sumx(c,[Slope1])
but the result is most likely not what you wanted.
nufffins
3 years agoFrequent Visitor
Thanks for looking in to it.
I think it should be: var c = LINESTX(b, LN([A]), [Time])
However, using the whole code gives me empty column.
I made a sample PowerBI including
1) rates calculated in excel for comparison
2) "Result" query with the result I want.
It is uploaded here: https://we.tl/t-Z4SHQi0d30