Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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.

Tags (1)
1 Solution

Accepted Solutions
Highlighted
Luminary
Luminary

Re: Trendline slope

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
Highlighted
Master II
Master II

Re: Trendline slope

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

Highlighted
Not applicable

Re: Trendline slope

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.

Highlighted
Creator II
Creator II

Re: Trendline slope

Hi Zelman15,

Do u want something like this?

Capture.PNG

Regards,

Prasad

Highlighted
Not applicable

Re: Trendline slope

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.

Highlighted
Master III
Master III

Re: Trendline slope

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

Highlighted
Luminary
Luminary

Re: Trendline slope

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