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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

linest_m and aggr function issue

Hi guys,

I have a problem when i want to estimate the relationship between two variables with a linear relationship.

I have two fields: MU and DETAILS and I wish to obtain a linear regression between the two by month (aggregation variable called MY).

The first method I tried didn't work because I used the simple expression linest_m(MU,DETAILS) which didn't accomplish the MY aggregation part resulting in wrong values. I could however obtain a chart "sliced" by dimension and organize a top ten.

Nevertheless, I got the formula working when i finally tried:

linest_m(aggr(sum(MU),MY),aggr(sum(DETAILS),MY)) or linest_m(total aggr(sum(MU),MY),aggr(sum(DETAILS),MY))

The values are correct with the latter formula, but somehow it's now impossible to "slice" these values by dimension in a chart (for instance, using Age Interval). It only shows the global value and to obtain each of the individual values, several selections have to be made in a list box.

It's acceptable but not quite good for a visual side by side analysis in a chart.

Is there any way to obtain a linear regression by month variable and then use in a chart/table (to get a top ten linest_m results)?

Thanks in advance for your help!

1 Reply
Not applicable
Author

The same way, the following function (much simpler than linest_m) doesn't work in a chart by dimension:

avg(total aggr(sum(MU),[Y-M])/aggr(sum(DETAILS),[Y-M]))

Any thoughts?