I Attached a query in which I need to calculate a linear trend line.
I found this solution, "Calculate linear trend line in TSQL", and hoped that I could use the very fine solution in my query.
Unfortunatly I get a "Divide by zero" error. See lines 83 and 84 i the attached query
Can anyone see what is wrong. And is this the way to make a trend line.