distribute, distribute advance
This function distributes a value over a time line of intervals such as days, weeks, months, quarters and years. Either a fixed total value is distributed
between two specified dates, or a combination of start date and capacity (unit per day) is provided and the end date will be calculated automatically
(e.g. Total value = 10, capacity per day = 2 means 5 days).
Doing a production planning with production start date, production end date and number of items to produce is a good example.
If a batch size is given (e.g. 10 items produced at a time), then specify it.
If the distribution should not be bound to deliveries, but to purchasing / receiving required material for these items, then use the function distribute advance.
Alternative to total value, the softqutoed string '#days' (use no or single quoatation marks, but not double quotation marks) can be specified instead of the total
value in order to return the number of days instead. Note regarding dates: Dates are always considered as plain dates, ignoring time of day info if contained in the date values.
Detailed overview with many examples: See available PDF overview
Indirect parameter passing is disabled
10-14
No. | Type | Description | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 input |
numerals or strings | Total value Total value to be distributed over the timeline. | ||||||||||||||||||||||||||
2 input |
numeral | Batch size The batch size must be 0 or a positive value. | ||||||||||||||||||||||||||
3 input |
date or string converted to date | Start date Must provide a valid date. Any time of day info will be ignored. | ||||||||||||||||||||||||||
4 input |
date or string converted to date | End date Must provide a valid date which must be after the start date or at the same day. Any time of day info will be ignored. | ||||||||||||||||||||||||||
Alt. 4 input |
numeral | Capacity per day Instead of specifying an end date, you an also specify a capacity value in units per day. The end date will be calculated automatically. | ||||||||||||||||||||||||||
5 input |
string | Intervals This parameter determinse if you want to do a plan on daily, weekly, monthly or other basis. Note that a daily planning is the most fine-grained option and produces the biggest and most detailed plans.
| ||||||||||||||||||||||||||
6 input |
string | Usance Usance is a work and trade practice parameter which is used in association with the 5th function parameter Intervals.
| ||||||||||||||||||||||||||
7 input |
date or string converted to date | Output Start date This value specifies the starting date for the output to generate. If 5th parameter is not 'days', then the date will be moved back to the begin of the chosen interval (weeks, months, quarters, years). E.g. if '31.05.2017' is specified for months, then the whole month of May will be considered. | ||||||||||||||||||||||||||
8 input |
date or string converted to date | Output End date This value specifies the ending date for the output to generate. If 5th parameter is not 'days', then the date will be moved forward to the end of the chosen interval (weeks, months, quarters, years). E.g. if '01.05.2017' is specified for months, then the whole month May will be considered. | ||||||||||||||||||||||||||
9 output |
set containing dates | Timeline Start Dates set containing dates related to the values returned in the next parameter (Distributed values). If interval other than days is specified, then the starting date of the week/month/etc... will be returned. | ||||||||||||||||||||||||||
10 output |
set containing numerals | Distributed Values Actual result: Total values distributed over the specified timeline | ||||||||||||||||||||||||||
Opt. 11 output |
numeral | Earlier Sum Non-zero if distributed values exist before the output start date specified in order not to miss them. | ||||||||||||||||||||||||||
Opt. 12 output |
numeral | Later Sum Non-zero if distributed values exist after the output end date specified in order not to miss them. | ||||||||||||||||||||||||||
Opt. 13 input |
set containing dates | Bank Holidays A set of dates may be supplied to declare specific days as bank holidays so these days will not be counted. This parameter is rejected if the Usance '30_360' is chosen.
The dates may be provided as data type date or string containing legitimate dates. Type conversion to dates takes place automatically.
| ||||||||||||||||||||||||||
Opt. 13 input |
set containing dates | School Holidays A set of dates may be supplied to declare school holidays (vacation days). This parameter is rejected if the Usance '30_360' is chosen.
The dates may be provided as data type date or string containing legitimate dates. Type conversion to dates takes place automatically.
An even number of dates must be specified as the first date describes the first vacation day and the next date describes the last vacation day.
|
Type | Description |
---|---|
boolean | Total value fully distributed true if the total value has been fully distributed between output start and output end date and optionally to the output values Earlier Sum and Later Sum. |
Division by zero error happens if WACC equals to the perpetual growth rate
distribute( #days, 0, '06.01.2018', '25.01.2018', days, calendar, '01.01.2018','31.01.2018', date line[], distributed values[] );
echo( date line[]{0},", ", date line[]{1},", ", date line[]{2},", ", date line[]{date line[]{}-1} );
echo( join( distributed values[], ", " ) );
2018-01-01, 2018-01-02, 2018-01-03, 2018-01-31
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0