Valentino-
First, I assume, your third row should be:
Customer1 201503 15%
Slope over a sequence of numbers is defined as:
If it is the case that you have an open credit reading each month, then x minus previous x (number or months) will always be 1. Thus your slope calculation becomes the sum of the percentage intervals divided by the count of intervals. (Sum of 1 squared will be the Count.)
If data is missing for any month, then the calculation becomes more cumbersome because some x intervals might then be more than the value 1 month.
It might be possible to write a custom VBA function to do the calculation. You would pass it the name of the table, the name of the column providing the key value (CustomerID ?), and the name of the x and y columns. The code would have to open a recordset on the table filtered for the key value and sorted ascending by x values. It could then run through the available rows, performing the difference, multiply, and square calculations, then return a final value. The trick is knowing the "unit" of the x column - in your case one month, but the value in the column is year and month number. The calculation is easy when the x values are all in the same year, but become problematic when you cross a year boundary because, for example, 201501 minus 201412 is 89, not 1. You would have to write code that's specific to the custom format of the x values presented by your problem.
Do you need me to take a stab at writing the code?
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
Hello,
sombody knows how to do slope function in Access?
I have 3 fields:
Customer
X = month-year
Y = percentage of open credit> of 1 year respect total open credit
Customer1 201501 10%
Cusotmer1 201502 20%
Cusotmer1 201502 15%Customer2 201501 15%
Customer2 201502 10%
If I analyse the Graph in Excel grouping all customer togheter I can see, using regression line, if the situation of open credit is gettings worst referred to the age of the credit (more or less than one year).
the next step is identify the customer that are increasing this percentage
IN other words ar eall customer for which the slope is positive
I would like to have a sort of grouping query where for each customer I can have the slope in order to have the list ordered for slope value
that at the end is the indication who are the customers where the open credit is getting worst in the period selected
any idea?
Tidak ada komentar:
Posting Komentar