Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
gshockxcc
Creator
Creator

Rate of change (mathematical derivative)

I have attached a sample file, where I have plotted a range of data, and set a linear trend line, and the corresponding linear equation.  My objective is to calculate the difference between the data point and the corresponding theoretical data point on the linear trend line.

For example, the data point at 4/28/2015 9:10 PM, the value is 108.3.  The corresponding value from the trend line is approximately 132.8.

I don't know how to get the trend line equation, and input the x-axis value to calculate the corresponding y-value on the trend line.

Obviously, once I have the value on the trend line, then I can simply take the difference between those two data points.

EDIT:  Once this capability is in place, then I can repeat this for every data point, hence the derivative... then I can calculate how quickly this difference is changing.

Thanks in advance,

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

4 Replies
Clever_Anjos
Employee
Employee

I think this can help you Computing Linest_M

gshockxcc
Creator
Creator
Author

Somewhat related, but not exactly what I'm looking for.

I am am trying to implement Linest_M, and Linest_B, and will implement and try to explain better.

swuehl
MVP
MVP

Try something like

LINEST_M(TOTAL  aggr( Avg( [2LI1252403] ), DateTime), DateTime)*DateTime

     +LINEST_B(TOTAL  aggr( Avg( [2LI1252403] ), DateTime), DateTime)

as expression in your chart to get the linear trend line y-value for given x-value of DateTime.

pokassov
Specialist
Specialist

Hello!

You can use this expression to calculate difference between them and your expression "=Avg( [2LI1252403] )"

=LINEST_M( total  aggr(avg([2LI1252403]),DateTime), DateTime)*DateTime

+linest_b(total aggr(avg([2LI1252403]),DateTime), DateTime)