2dYTD
  • 1 Minute to read
  • Dark
    Light
  • PDF

2dYTD

  • Dark
    Light
  • PDF

Article summary

2dYTD

Adds the current row to the cumulative total and resets when the year changes

  1. Adds the current row to the running total (TD)
  2. If the year of the date-time field changes (eg from 2019 to 2020), resets the sequence to the running total to be the current row (Y)
  3. Resets the sequence when dimension 1 changes (2d)

Purpose

Use this function to: 

  • Calculate YearToDate, where data needs to be grouped by another dimension and sequence needs to reset when the year changes

Calculation

2dYTD= sum(RowX:Row0)

RowX= current row
Row0 = first row in the sequence

Sample Result

Parameters

ParameterDescription
DimensionsDiscrete field(s).    All fields must come from the same table.
NameName to be displayed as Column Header in result grid
Measure

The field to be used in the post-function calculation.

  • Must be numeric if Function is anything other than COUNT.
  • Must come from same table as DIMENSIONS.
  • Supports Discrete or Continuous DataTypes.
FunctionCOUNT / SUM / AVG / MIN / MAX / STDEV
Post2dYTD
Value

Optional.   Filter to apply when evaluating FUNCTION.   Only records in the Filter Recordset will be included in the Function and Post-Function calculations.

Must come from same table as DIMENSION/MEASURE or be linked to the Dimension table.

Axis0 / 1.    Y-Axis to use when plotting graph.     Default = 0
PlotY / N.   Specifies whether measure’s output column should be plotted on graph.  Default = Y
ResolveOptional.   Resolve level for the measure.   If blank, Resolve = Dimension Table
Series Type

Default / Bar / Stacked Bar / Line / Spline / RangeLow / RangeHigh / CSLow / CSHigh / CSOpen / CSClose

Determines the graph style for the measure.

PopupDefault / None / Extended
Prefix$ / £ / E / %


Usage Notes

Requires 2 dimensions, of which one must be a date-time field or be a numeric sequence containing a valid YYYY format

Sort order is important:  Ascending / Descending Label / Value 

Example

NOTE: Measure 1 is included purely for illustration. It is not necessary to include this measure for the calculation to work.


Example use: Calculating Year To Date, grouped by Product Group

Dimension: [transaction].[product_group], [transaction].[yearmonth]

Measure 1

  • Name: = Sum Sales
  • Measure:  = [transactions].[castprice]
  • Function: = Sum
  • Post: =
  • Value: =
  • Axis: =0
  • Plot:=Y
  • Resolve:=
  • Series Type:=Default
  • Popup:=Default
  • Prefix:=

Measure 2

  • Name: = Sales to Date for Year
  • Measure:  =[transactions].[castprice]
  • Function: =sum
  • Post: =2dYTD
  • Value: =
  • Axis: =0
  • Plot:=Y
  • Resolve:=
  • Series Type:=Default
  • Popup:=Default
  • Prefix:=





Was this article helpful?

What's Next