Qlik Community

Qlik Server Side Extensions Discussions

Discussion Board for collaboration on Server-Side Extensions and Advanced Analytics Integration.

matthipe
New Contributor

Add linear regression script to the already available curve in an x,y-diagram

How can I add the available script for linear regression (to be chosen from the QLIK functions list) to a curve in an x,y-diagram?

I have chosen the right function, positioned it within the available x,y-diagram script, but the linear regression line was not added to the curve.

3 Replies
yannick_c
New Contributor III

Re: Add linear regression script to the already available curve in an x,y-diagram

balabhaskarqlik
Honored Contributor

Re: Add linear regression script to the already available curve in an x,y-diagram

May be this:

You can use below two expressions in your chart aggregated over the dimension.

=LINEST_M(aggr(Avg({TW1}($(vActiveUnitField))),Cofely.Id),aggr(Avg({TW1}Cofely.Temperature),Cofely.Id))

=LINEST_B(aggr(Avg({TW1}($(vActiveUnitField))),Cofely.Id),aggr(Avg({TW1}Cofely.Temperature),Cofely.Id))

balabhaskarqlik
Honored Contributor

Re: Add linear regression script to the already available curve in an x,y-diagram