CALC.amordegrc(cost, date_purchased, first_period, salvage, period, rate, [basis])
Returns the depreciation of an asset for accounting year period on a prorated basis according to the degressive method of the French accounting system. This CALC function returns the same result as the Excel function of the similar name. This function is similar to CALC.amorlinc(cost, date_purchased, first_period, salvage, period, rate, [basis]) except that the depreciation coefficient is calculated based on the life of the asset:
| Life of asset | Depreciation coefficient |
|---|---|
0-2 years |
1 |
3-4 years |
1.5 |
5-6 years |
2 |
>6 years |
2.5 |
Depreciation during the first (fractional) period is given by:
cost * rate/100 * CALC.yearfrac(date_purchased,first_period,basis)
Depreciation during (whole) periods 1 and 2 is given by:
rate * cost
Depreciation during the final (fractional) period is the difference between the asset’s value in the previous period and the asset’s salvage value. The function returns 0 for periods after which the asset has already reached its salvage value.
Parameters
- cost
-
Initial cost of the asset
- date_purchased
-
Date object: Asset purchase date
- first_period
-
Date object: End of the first period
- salvage
-
Salvage value at end of asset life
- period
-
Period (year) for which to return depreciation
- rate
-
Rate of depreciation
- basis
-
Optional day count convention code (0, 1, 2, 3, 4):
Code Day Count Convention 0
US 30/360 (default)
1
Actual/Actual
2
Actual/360
3
Actual/365
4
European 30/360
Example
Depreciation over time of a $2400 asset purchased on August 19, 2008, with first depreciation period ending December 31, 2008, end-of-life salvage value of $300, 15% rate of depreciation, and Actual/360 counting method.
var deprec = 0;
for(var period = 0; period < 7; period++) {
deprec = CALC.amordegrc(2400, new Date(2008,7,19), new Date(2008,11,31), 300, period, 0.15, 2);
alert('Period ' + period + ': Depreciation of ' + deprec);
}
// Returns:
// Period 0: Depreciation of 335
// Period 1: Depreciation of 774
// Period 2: Depreciation of 484
// Period 3: Depreciation of 303
// Period 4: Depreciation of 189
// Period 5: Depreciation of 158
// Period 6: Depreciation of 0
To reference data when scripting a Data Worksheet Expression Column or Dashboard Calculated Field, use the field syntax. Example:
CALC.amordegrc(2400, field['PurchaseDate'], field['DeprecDate'], 300, period, 0.15, 2);
To reference data in Dashboard global script, component script, or property script, use keywords such as value, selectedObjects, data, table, or parameter. Example:
CALC.amordegrc(2400, RangeSlider1.selectedObjects[0], RangeSlider1.selectedObjects[1], 300, period, 0.15, 2);
CALC.amordegrc(2400, parameter.PurchaseDate, parameter.DeprecDate, 300, period, 0.15, 2);
How to access data in Data Worksheet Expression Columns…To create an expression column in a Data Worksheet, press the ‘Create Expression’ button . (See Create a New Data Field for more details.)
Insert fields (and parameters) into the script by clicking the items in the tree. Example syntax:
To reference the data contained in other cells of the data block, see the topics below: Example 1. Cell Referencing
This example illustrates how you can reference the cells of another data block from within an Expression Column. You will use the tables in the folder of the ‘Orders’ data source to create a data block that has columns for product ID, product name, category ID, and category name.
Let’s say that you want to add a column to the ‘PRODUCTS1’ data block that will contain the category name corresponding to each entry in the ‘CAT_ID’ column. The best way to do this is to join the data blocks together (see Join Data), but to practice using cell references, in this case you will create this new column as an expression column. Follow the steps below:
How to access data in Dashboard Calculated Fields…To create a calculated field in a dashboard, right-click on the data block, data model, or query to which you want to add the calculated field, and select ‘New Calculated Field’. (See Create a New Data Field for more details.)
Insert fields (and parameters and component properties) into the script by clicking the items in the tree. Example syntax:
How to access data in Dashboard Property Expressions…To set a Dashboard property value using an expression, press the ‘Value Type’ button and select the ‘Expression’ option to open the Formula Editor. (See Dynamically Set Properties for more details.)
To insert a reference a component’s data, use the value, selectedObjects, data, or table property of the component. Example syntax:
See Dashboard Object Reference for information about accessing dashboard settings and data in script.
How to access data in Dashboard Scripts…To add script to a Dashboard component, right-click the desired component, and select ‘Properties’ from the context menu to open the ‘Properties’ panel. Note: You can also access menu options from the ‘More’ button () in the mini-toolbar. Select the Script tab to open the Script Editor, and select either Script or onClick. See Add Component Script for more information about these options.
To add global script to a Dashboard, press ‘Options’ button in the toolbar to open the ‘Dashboard Options’ panel. Select the Script tab to open the Script Editor, and select either onInit or onRefresh. See Add Dashboard Script for more information about these options.
To insert a reference a component’s data, use the value, selectedObjects, data, or table property of the component. Example syntax:
See Dashboard Object Reference for information about accessing dashboard settings and data in script. |













