BusinessObjects Board

Graphing Linear Trend Lines

Hello to Aberdeen - I bet its FREEZING up there! :mrgreen: I may be missing the point but this trend line must have rules to create it? So can you simply create a variable that follows these rules, then add the variable to the chart?


Nick Daniels :uk: (BOB member since 2002-08-15)

Hi,

It will not be easy to reproduce an Excel Trend Line in Business Objects but in theory it should be possible.
Excel uses the Least Squares Fit model which you would need to replicate within Business Objects variables.

What I suggest you do is search on the Excel help pages for the LINEST function - this will give you the information for the calculation.

Cheers

Mike


Mike Churchill (BOB member since 2003-07-10)

Thanks Nick and Mike for your replies (and yes it is pretty cold up in Aberdeen, luckily I have just moved down to London this weekend where it’s marginally warmer :wink: )

You are right in that it’s just a case of plugging in formulas to get the required variable for graphing, my problem was that it is pretty complicated and my maths/stats isn’t the best so I didn’t know how to go about doing it. :oops: Walter sent me an old sample report of his that has shown me how to do it (Thanks Walter!!), and although I have to admit I don’t fully understand the nitty gritty of the formulas, it works when you plug them into the report. Will look at the LINEST function to see if I can make more sense of it all, but at least it seems to be working so the users are happy :smiley:

Thanks again,
Isabel.


isabelf (BOB member since 2002-08-16)

Do you think it would be useful to post the formula here for other people or is it too specific to exactly what you were doing?


Nick Daniels :uk: (BOB member since 2002-08-15)

Nick,

Yep I think it would definitely be useful to share the solution - only thing is it’s not just the one formula involved. Easiest thing for me to do is probably to send the sample report that Walter Muellner was kind enough to share with me, that contains all the variables and calculations needed to calculate the trend. I will send this to bobdownloads now so that it can be posted in the appropriate forum (I take it that’s the process for submitting samples?).

Cheers,
Isabel.


isabelf (BOB member since 2002-08-16)

Thanks, if you haven’t already then bobdownloads@forumtopics.com is the address - it would be worth including a link to this explain what it is you are sending!


Nick Daniels :uk: (BOB member since 2002-08-15)

The sample has been uploaded, and can be found here.


BOB Downloads (BOB member since 2003-05-05)

Sorry to bring up an old issue… However this trend line is exactly what I want, but I can’t figure how to apply it to my situation.

I have dates on the X-axis and a count of users on the Y-axis.

Has any found an easier way or at least a way to do this with fewer variables?

Thank you.


vdog_2000 :us: (BOB member since 2002-11-14)

The sample is very useful but I like to know if someone has an idea on how to alter it so instead of using it in a graph on a weekly or monthly basis I can use it in a graph on a daily basis. The problem here is when there’s days missing in the data (because of weekends, holidays, etc) the line has a different angle for that part. Thanks!


Drexl :netherlands: (BOB member since 2004-04-21)

I got another problem when I try to make the report on a weekly basis. The first few days of the new year belong to the last week of the previous year. But when I set up the trendline the values of those days (the first few of the new year belonging to the last week of the previous year) are put in the last week of the new year. Thus making the data for that last week incorrect. Does anyone have an idea how to solve this problem. Thanks!


Drexl :netherlands: (BOB member since 2004-04-21)

Just an FYI… Oracle has a least-squares regression function built in (not sure when it was included, but it is in at least by Oracle 9i):-

REGR_SLOPE(Y_Column,X_Column)
and
REGR_INTERCEPT(Y_Column,X_Column)

These can be used in conjunction with your DB values to build the graph (i.e. y=x*slope + intercept)

The X and Y columns must be numeric, but dates could be handled by getting days between the column and a fixed date (1/1/1970 to pick a number out of a hat), get the slope and intercept, and adding the calculated y value to the date again.

Cheers
Scruffy


scruffy :australia: (BOB member since 2005-01-19)

Would you by any chance have the report using these oracle regr_slope and regr_intercept functions?

Thanks!


SB8 (BOB member since 2005-05-02)

This is an awesome tool, THANKS.

I have a question. When I try to use this for multiple years (in the same chart) the trend line starts over. In other words, it shows a trend for 2008, then the trend for 2009, etc.

Without the year, the trend line is straight as expected, but it is not when I add the year. In the example provided he used sections to display multiple years, can multiple years be shown in one chart?

What I want is to show 2008, all 12 months, 2009, all 12 months, etc with a single trend line showing a trend into 2010.

Any ideas how to modify this to do that?
trendlinesample.doc (27.0 KB)


REB01 :us: (BOB member since 2004-11-29)

Hi,

I’ve encountered the same problem like you. I tried alter the formula a little bit and it works great! :smiley:

What I did is…

I create a new variable (dimension) called <SQ_month> with the formula:

=If(MonthNumberOfYear(CurrentDate())) < 12 Then [Mnth Num]+12 Where(Year(CurrentDate())=[Yr Num])

This SQ_month is purposely to make the X_month as sequence number. So, the linear trendline will not start over again.

Then, in y_month formula, instead of using <X_month>, change it to <SQ_month>, like below:

=([a_month]+[b_month]*[SQ_month])

p/s: just found out that u need to change X_month to SQ_month in the Nominator_month as well, like

=(Sum(<SQ_month> * <Revenue>) In Block * <N_month> In Block) - (Sum(<SQ_month>) In Block * Sum(<Revenue>) In Block)

Hopefully it can help solve your problem too :mrsbob:


areknee :malaysia: (BOB member since 2010-04-07)

Hi guys,

I’ve found the easiest way to create a linear trendline.

Just create a new variable using Interpolation.

Syntax
number Interpolation(measure;[interpolation_method];[NotOnBreak];[Row|Col])

Input
[measure] : Any measure

interpolation_method : The interpolation method (optional):
PointToPoint - point-to-point interpolation. This is the default interpolation method when you do not supply the argument.
Linear - linear regression with least squares interpolation

NotOnBreak : Prevents the function from resetting the calculation on block and section breaks. (Optional.)

Row | Col : The calculation direction (optional)

Example:

=Interpolation([Revenue];Linear;NotOnBreak;Col)

done! YAY!

p/s: Sorry. Just found out this topic for DeskI, unfortunately I tried this using WebI BOXI 3.1. Hopefully Deski also have this functionality…


areknee :malaysia: (BOB member since 2010-04-07)

Areknee

thank you for the formula. I am using DeskI and modified my formula as below…

=If(MonthNumberOfYear(CurrentDate())) < 12 Then+12 Where(Year(CurrentDate())=)

I am getting the error 'Incorrect data type (DMB0003) and “Where” is highlighted as the cause of the error.

Any suggestions?


REB01 :us: (BOB member since 2004-11-29)

That’s mean Year(CurrentDate()) and is not in the same datatype.

Try check the , is it number or character? It should be number, is it?


areknee :malaysia: (BOB member since 2010-04-07)

It is a number, I will continue to work with the formula to try to determine what’s wrong.


REB01 :us: (BOB member since 2004-11-29)

I posted some articles on how to build trendlines.

Enjoy

Binabik,


Binabik (BOB member since 2011-11-14)

Is it me, or does the interpolation function not create a trendline at all.

when you enter the function =interpolation() it just returns the number itself and it tries to identify the missing parts of a number.

I would like to thank the OP for putting me on the track of the interpolation function, but it turns out to do something entirely different.

Here’s what it does :

but maybe I’m missing the other use you’re trying to attach to it. Would be interested to learn more about that part.

Binabik


pderop (BOB member since 2010-10-27)