Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
etrotter
Creator II
Creator II

Linest M Errors

Hello,

I am trying to get the Linest_M function working, the goal is for when the slope is positive the line is green, and when it is negative it is red. the x value is YearMonth and the Y value is Sum([Billing Quantity])/Sum(#Units)

Here is what I have:

=if(

LINEST_M(Sum([Billing Quantity])/Sum(#Units), YearMonth)
<0, rgb(247,93,79),rgb(155,215,247)
)

Please let me know how to correct this

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

May be try this

=If(Linest_M(TOTAL Aggr(Sum([Billing Quantity])/Sum(#Units), YearMonth), YearMonth) < 0, RGB(247,93,79), RGB(155,215,247))

View solution in original post

5 Replies
sunny_talwar
MVP
MVP

May be try this

=If(Linest_M(TOTAL Aggr(Sum([Billing Quantity])/Sum(#Units), YearMonth), YearMonth) < 0, RGB(247,93,79), RGB(155,215,247))

etrotter
Creator II
Creator II
Author

Capture.PNG

Is it supposed to fluctuate by the x value?

sunny_talwar
MVP
MVP

Really, why? you want to know the slope of the line, right? Slope stays the same, doesn't it?

etrotter
Creator II
Creator II
Author

Ideally it would be a monthly snapshot of the slope, as if taking a derivative of the original line, but that might not be the way the function works.

sunny_talwar
MVP
MVP

Are you looking to find the monthly slope based on daily data? May be try this

Linest_M(Aggr(Sum([Billing Quantity])/Sum(#Units), YearMonth), YearMonth, Date)