Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Trendline slope

Hello

Is there any possibility of having in the table slope of a trendline?

I've got amount of sales in time and i'd like to have % value of the trendline in a table so i could tell if sales are increasing or decreasing.

1 Solution

Accepted Solutions
jvitantonio
Luminary Alumni
Luminary Alumni

Hello Zelman,

This is possible and it's very simple. You can use the function called "Linest_m". Linest_m returns the slope of a linear regression defined by the equation y = mx + b.

So for example, you can have an expression in your table like this:

LINEST_M(aggr(nodistinct sum(Sales), Month, Product), Month)



If Linest_M > 0 then you have a positive trend, and if it's < 0 you have a negative trend .If it's 0, then the slope is undefined meaning  that all data points (x, y) are equal.

You need to modify the aggr() function depending on what dimensions you want to aggregate your values.

I'm attaching an example.

JV.

View solution in original post

6 Replies
sushil353
Master II
Master II

Hi,

it is better if you could tell the specific requirement with an example..

and there are some trendline option available in your chart property>expression>Trendline (lower left corner).

HTH

sushil

Not applicable
Author

Ok, some kind of example for better idea of what i want.

Capture.PNG

I've got this chart and i want blue line of trend to be in table.

Maybe % of slope, maybe there's some method to get value of starting and ending point so i could see if it's going up or down.

prasadcm
Creator II
Creator II

Hi Zelman15,

Do u want something like this?

Capture.PNG

Regards,

Prasad

Not applicable
Author

I have already tried doing something like this and it's not what i'm looking for.

I have to tell if trending line is ascending or descending.

If there was possibility of putting trending line into this chart, it would be good enought for me, but i haven't found this option anywhere.

antoniotiman
Master III
Master III

Hi,

I think can't be done what You want.

However, You can use ColorMix1() in background color of expression

like this

ColorMix1.png

You can use wizard of ColorMix1()

or in background color You can use expression like If(Expr > Average,Green(),Red())

Regards,

Antonio

jvitantonio
Luminary Alumni
Luminary Alumni

Hello Zelman,

This is possible and it's very simple. You can use the function called "Linest_m". Linest_m returns the slope of a linear regression defined by the equation y = mx + b.

So for example, you can have an expression in your table like this:

LINEST_M(aggr(nodistinct sum(Sales), Month, Product), Month)



If Linest_M > 0 then you have a positive trend, and if it's < 0 you have a negative trend .If it's 0, then the slope is undefined meaning  that all data points (x, y) are equal.

You need to modify the aggr() function depending on what dimensions you want to aggregate your values.

I'm attaching an example.

JV.