Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
brunolelli87
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:

 

4.png

 

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:
result.png

 

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

How can I do that?
Thanks

1 Reply
brunolelli87
Creator II
Creator II
Author

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?

 

Thanks