Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
sohb2015
Contributor III
Contributor III

Linear Regression

Hi Guys,

I want to create a bar chart which will project the data for next 4 months. I am aware of the fact that linest_m and linest_b can be used for linear regression. However, I am not able to do that properly and data seems incorrect.

I am attaching the input file. The file contains data from Nov-2016 to Mar-2017 data for three different countries. In the Bar chart, for each country, for next 4 months i.e. from Apr-2017 to July-2017, data needs to be projected. Can anyone help me with this.

Thanks.

1 Reply
sunny_talwar

May be this:

=If(Sum(Cost) > 0, Sum(Cost),

LINEST_M(TOTAL <Country> Aggr(Sum(Cost), Country, Month), Month)*Month + LINEST_B(TOTAL <Country>Aggr(Sum(Cost), Country, Month), Month))