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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get Equation and value R when I marked Linear in Trendlines

Hello, everyone.

I created a bar chart and markd Linear in Trendlines, it showed me the equation in chart.

But how can I get this equation and value R?

Thanks....

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

OK, attached is an example with a couple different ways of displaying the forecast. It turned out to be more complicated than I showed since you don't just have two fields, but rather a field and an expression. Here's how it ended up:

linest_m(total aggr(sum(Sales),Month),Month)*Month
+linest_b(total aggr(sum(Sales),Month),Month)

View solution in original post

5 Replies
Not applicable
Author

Hi.

I'm trying to use the equation to get the next value, so I need the linear equation (via macro, maybe).

Did you find the way?

Regards
Julian

johnw
Champion III
Champion III

I believe the equation for the trend line for a set of points (X,Y) is this:

Y = linest_m(Y,X)*X + linest_b(Y,X)

I've done that before to be able to mouse over the trend line and see the value at that point.

By R value, I think Ben means the correlation coefficient, which would be the correl() function, but it doesn't look like you needed that, though I do think it's important to show at least the correlation when making predictive models. In some cases, you may get a prediction, but there's no reason to believe it because the data is at best very loosely correlated.

Not applicable
Author

Hi John.

Thank you for your reply. Do you have any example of that? how to use it?

I have one Bar Chart, with Month as a Dimension and Sum(Sales) as Expression. How can I use what you said to find the equation and the next value (projection)?

Best regards
Julian

johnw
Champion III
Champion III

OK, attached is an example with a couple different ways of displaying the forecast. It turned out to be more complicated than I showed since you don't just have two fields, but rather a field and an expression. Here's how it ended up:

linest_m(total aggr(sum(Sales),Month),Month)*Month
+linest_b(total aggr(sum(Sales),Month),Month)

Not applicable
Author

That's so great!!!!!!