
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Displaying Slope/ Best Fit Line using Reference Line in a Scatter Plot Qlik Sense
I've explored many potential answers to this question. Many end up pointing to this answer How to add lineal trend in Qlik sense but it doesn't seem to work for a reference line in a scatter plot.
The attached qvf has the chart (Chart 1) from the above question and Chart 2 which is a scatter plot. Below that chart I have KPIs representing the variables for Chart 1 such as the slope and y-intercept.
I'd like to create a best fit line for Chart 2. I'm thinking the code might look like:
linest_m(total aggr(sum(Profit),Country),Freight)*
only({1}???)+linest_b(total aggr(sum(Profit),Country),Freight)
This mimics Chart 1 and is essentially y=mx+b.
- The equation is not correct-obviously
- What should go in the only() function?
- Even when it generates a line it returns a single value and therefore a straight line
- What should go in the only() function?
- I don't know where the above equation would go even if it was correct
- Add-ons>X-axis reference lines
- Add-ons>Y-axis reference lines
- As a third measure
My question is: how do you create a best fit line using y=mx+b (or anything) on a scatter plot chart in Qlik Sense?
Thanks so much for any ideas and suggestions and hopefully answers.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just wondering if you found a solution for this in Sense? Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nope. I decided to display best-fit with an excel graph haha. Or maybe I used mat plot lib. Either way it's too bad there is not a feature for this yet.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply Liam, yeah, it's too bad as its functionality available in QV..
