Skip to main content

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Skip the ticket, Chat with Qlik Support instead for instant assistance.
cancel
Showing results for 
Search instead for 
Did you mean: 
catalystmichael
Partner - Contributor III
Partner - Contributor III

Trend/Regression Line in a Scatter Chart

I've read through a lot of similar posts on here but can't find a good answer on how to plot a linear trend line in a scatter chart.  E.g. with X as Sum(Sales) and Y as Count(Customer) and Store as the dimension.  

I've used the linest_m and linest_b functions to create a linear trend in a bar/line chart but when it comes to a scatter i can't get it to work.  For the Linest_m function I can add the Y values by creating an aggr() table but it doesn't seem to like it if I try the same for the X values.  

Has anyone had any success with this (using the reference lines)?

@Michael_Tarallo - I've read your posts on using the linest functions in bar and line charts and they make sense.  Any thoughts on how to use them in a scatter where X and Y are both aggregates?

Labels (6)
4 Replies
miguelbraga
Partner - Specialist III
Partner - Specialist III

Hi there,

 

Maybe you could try using a Combo Box type chart instead. I guess the result you need will be the same as a Scatter Chart. Try your approach with a Combo Box.

 

Best regards,

MB

catalystmichael
Partner - Contributor III
Partner - Contributor III
Author

Hi MB,

The problem with a combo chart is that the only dimension is the X axis.  No option to split points/markers out by another dimension like you can in a scatter.

I get where you're coming from in that in a combo chart I could use, for example, aggr(count(customers),store) to create the equivalent x axis of count(customers) in a scatter chart.  The problem still remains of not being able to split out the markers though.  

WernerDC
Creator
Creator

@catalystmichael I also want to know when we will be able to do Regression lines on Scattor plot. It is quite an important feature to have. 

@Micheal Tarallo  The integration with R is not friendly and I cant get it to work. Do you guys have...

pg1234
Partner - Contributor
Partner - Contributor

I am trying to get this to work as well.

I used a trend.qvf post from another thread as a dataset.  My Scatter Plot is based of:

Dimension: Category

x axis: sum(COS)

y axis: sum(Sales)

Based on other threads I read, I can get the m and b properly but I cannot combine them together to get y i.e. y=mx +b.

I tried:

LinEst_m(if(aggr(sum(Sales),CategoryName),aggr(sum(Sales),CategoryName)),aggr(sum(COS),CategoryName))*only({1}(aggr(sum(COS),CategoryName))) +

LinEst_B(aggr(sum(Sales),CategoryName),aggr(sum(COS),CategoryName))

Any help would be appreciated.