Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
Showing results for 
Search instead for 
Did you mean: 
Creator II
Creator II

Linear expression from a specific date

Hello guys!

First of all, I would like to thanks everybody here who is helping me a lot. I'm learning too much here, and I believe I'm working with QlikView 12 horas a day, for more than a month. This software is amazing!


Now my question is:
How can I calculate (via expression), the linear trendline, starting from a specific date ('18/03/2020')?

Look at that:
Trendline overall.png

In this case, QlikView is calculating the overall Trendline (based on my dates selection), but I would like to get something like this - see below:




I'm currently working with the following expression, but I'm not getting the correct result:


if( DVPG > '18/03/2020',
	linest_m(total aggr(if(sum(VDAF) ,sum(VDAF)), DVPG), DVPG)
	* only(DVPG) + linest_b(total aggr(if(sum(VDAF) ,sum(VDAF)), DVPG), DVPG)



This is the chart I'm getting, and obviouly it's correct:


The Date field is called DVPG, and the Y axis field is called VDAF.

How can I do that?

1 Reply
Creator II
Creator II

Hey guys, I think I got it with the following expression:

=If(DVPG > '18/03/2020',
(LINEST_M(TOTAL Aggr(avg(DISTINCT If(DVPG > '18/03/2020', VDAF)), DVPG), DVPG) * DVPG)
+LINEST_B(TOTAL Aggr(avg(DISTINCT If(DVPG > '18/03/2020', VDAF)), DVPG), DVPG))


What do you guys think about this solution?