--- title: "zdelta" slug: "zdelta" updated: 2022-11-08T13:15:44Z published: 2022-11-08T13:15:44Z canonical: "docs.datajet.app/zdelta" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.datajet.app/llms.txt > Use this file to discover all available pages before exploring further. # zdelta ## PostFunction: [zdelta] #### Returns the difference between current row and previous row for the specified measure. i.e., Subtracts the previous row from the current row. First row is 0.00 Note: to have first row returned as null, see **PostFunction: delta** #### ## Purpose Use this function to: - See how a measure changes from one row to the next - Calculate changes from one reporting period to the next ## Calculation ```actionscript zdelta = Row(X) - Row(X-1) Row(X) = "value for current row" Row(X-1) = "value for previous row" zdelta= Row(X) - Row(X-1) ``` ## Sample Result ![zdelta_sample](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/zdelta_sample.PNG) ## Parameters | Input | Description | | --- | --- | | **Dimensions** | Discrete field(s). All fields must come from the same table. | | **Name** | Name 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. | | **Function** | COUNT / SUM / AVG / MIN / MAX / STDEV | | **PostFunction** | **zdelta** | | ***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. | | ***Axis*** | 0 / 1. Y-Axis to use when plotting graph. Default = 0 | | ***Plot*** | Y / N. Specifies whether measure’s output column should be plotted on graph. Default = Y | | ***Resolve*** | Optional. 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. | | ***Popup*** | Default / None / Extended | | ***Prefix*** | $ / £ / E / % | ## Usage Notes The order of the dimensions is important as this will affect the inter-row calculations. Sort by Label or Value, Ascending or Descending. Can be used with multiple dimensions as calculates difference between each row. ## Example Calculate difference in sales from one month to the next (Month on Previous Month) *e.g Sales difference by month* Table: Transactions Dimension: [Transactions].[YearMonth] Measure: [Transactions].[CastPrice], SUM, **zdelta** NoteMeasure 1 is included purely for illustration. It is not necessary to include this measure for the calculation to work. | Dimension(s): | [transactions].[yearmonth] | | --- | --- | | Measure 1 | - Name: =Sales This Month - Measure: = transactions.castprice - Function: =sum - Post: = - Value: = | - Axis: =0 - Plot:=Y - Resolve:= - Series Type:=Line - Popup:=Default - Prefix:= | | Measure 2 | - Name: =Monthly Change - Measure: =transactions.castprice - Function: =sum - **Post: =zdelta** - Value: = | - Axis: =0 - Plot:=Y - Resolve:= - Series Type:=Bar - Popup:=Default - Prefix:= | ### **![zdelta_example1](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/zdelta_example1.png) ![zdelta_example2](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/zdelta_example2.png)** See Also: - [Engineering](/v1/docs/engineering) - [Post Functions - Overview](/v1/docs/post-functions-overview) - [delta](/v1/docs/postfunction-delta)