Time Series Tags

A Time Series is defined using a time-series tag with some required and optional tags between open { and close } braces. Time series are defined within a cPlan.

Time Series Tags

Tag Examples Notes
time-series

time-series "myts" label="My T/S"{

...

}

time series {

...

}

Indicates the block is for a time series. A name and label are optional, but useful when defining multiple time series.

When used alone, the string following the time-series tag becomes a prefix for the column names. If the label tag is used, the specified label becomes the prefix for the generated column names.

anchor

anchor `date("2013/04/15")`

anchor `date(param("set-anchor"))`

anchor `top(max(value("Ship Date")))`

Gives a reference point for the range. Set the expression dynamically with a parameter, import a calc from a text file, or use the last date in the cPlan.
calc-set calc-set "Order Date Time Series" Places all columns into a calc-set so that they can be easily referenced in a Dive script.
custom

ranges {

custom "Custom" start=`date("2014/03/15")` end=`date("2014/06/04")`

}

Specifies a custom date range.
date

date "Invoice Date"

date `value("Year-Mo")`

Indicates the date data that is the focus of the series. The column or expression must resolve to a date that can be used to determine if a row is included in a calculation.
difference

variations {

previous-year {

difference

percent-difference

}

}

Indicates that for each summary and range, also produce last year (LY), TY Diff (TY-LY), and TY % Diff (pct_var(TY,LY)) columns.
filter filter `value("Units") > 20` Applies a filter to the data from the source.
forward

time-series {

date `value("Date")`

anchor `date("2014/07/24")`

summary "Row"

ranges {

rolling-months 3 forward=true

}

}

time-series {

date `value("Date")`

anchor `date("2014/07/24")`

summary "Row"

ranges {

recent-years 2 forward=true

}

}

Applies to rolling-X and recent-X ranges. Default is false.

When set to true for rolling-X, instead of RW3 for "rolling weeks 3", this leads to "FRW3" for "forward rolling weeks 3".

When set to true for recent-X, this leads to "M+0", "M+1", "M+2" and so on, instead of the usual "M-0", "M-1", "M-2".

First example with the rolling range results in Row FR3.

Second example with the recent range results in Row Y+0 and Row Y+1.

TIP: If you are not using the forward attribute, you can use negative numbers to generate the same results.

label

summary "Total Admissions Count" label=""

summary "Total Admissions Count" label="Admissions <br>"

Changes the label for a summary column defined in the time series.
label-format

recent-years 2 label-format="YYYY"

year-to-date label-format="YYYY \\Y\\T\\D"

months label-format="YYYY \\M## (MMM)"

Controls the format for the range label component when used with a ranges tag. Only applies to year and month based ranges.
label-order label-order "RANGE SUMMARY " Controls the order of label components for generated column labels. Use SERIES, SUMMARY, RANGE, and VARIATION to change the default column names.
percent-difference

variations {

previous-year {

difference

percent-difference

}

}

Indicates that for each summary and range, also produce LY, TY Diff (TY-LY), and TY % Diff (pct_var(TY,LY)) columns.

summary summary "Cases"
summary "Net Sales"
Names the summary columns to use to create additional time series columns.
ranges

ranges {

year-to-date

month-to-date

current-month

current-quarter

}

ranges {

all-months

}

ranges {

rolling-months 3 forward=true

}

ranges {

recent-years 2 forward=true

}

Lists the ranges to calculate.

In the first example, for each summary, produce YTD, MTD, M, and Q columns.

In the second example, create 12 calculations per summary, that is M01 through M12.

In the third example, create FR3 columns.

In the fourth example, create Y+0 and Y+1 columns.

Ranges are based on a combination of a base (day, week, month, quarter, tertile, half, or year) and a type (current, to-date, all-year, rolling, and recent).

See Time Series Ranges for a complete list of ranges.

variations

variations {

previous-year {

difference

percent-difference

}

previous-years <number> {

difference

percent-difference

}

previous-range {

difference

percent-difference

}

previous-ranges <number> {

difference

percent-difference

}

}

Specifies one or more previous years or ranges and possibly two sub-variations: difference and percent difference.

For example, the first block specifies that for each summary and range, also produce LY, TY Diff, and TY % Diff columns.