--- title: "lgdelta" slug: "lgdelta" updated: 2023-03-20T12:46:57Z published: 2023-03-20T12:46:57Z canonical: "docs.datajet.app/lgdelta" --- > ## 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. # lgdelta ### Returns the difference between the natural logarithm for the current row and the natural logarithm for the previous row ## Purpose Use this function to: - Calculate the change in logarithm ## Calculation 1. Calculates the natural log for each row *(log)* 2. Calculates the difference between the logs *(lgdelta)* **lgdelta= log(RowX) - log(Row(X-1))** ***RowX** = value for current row* ***Row(X+1)** = value for next row* ***log(RowX) =** natural log for current row* ***log(Row(X-1)**= natural log for previous row* ## Sample Result ![](blob:https://datajetsoftware.atlassian.net/50f5b809-5007-4b9a-be74-3704af4b6788#media-blob-url=true&id=5d1cda29-583b-4205-8ebd-81596156845b&collection=contentId-489357347&contextId=489357347&height=500&width=377&alt=) ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1679315606704.png) ## Parameters ## ![](blob:https://datajetsoftware.atlassian.net/e49ab35e-d8a4-471a-bf19-8528563e40d6#media-blob-url=true&id=5d7603f8-cedb-4fb7-b287-fa263ba274bc&collection=contentId-489357347&contextId=489357347&height=245&width=919&alt=) | Parameter` | 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 | | Post | lgdelta | | 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 See [log](/v1/docs/postfunction-log) [](https://datajetsoftware.atlassian.net/wiki/spaces/ED/pages/488898575)for details on calculating natural logarithms. ## Example NOTE: Measures 1 and 2 are included purely for illustration. It is not necessary to include these measures for the calculation to work. Dimension (s): [transactions].[product_group], [transactions].[yearmonth] Measure 1 - Name: = Count - Measure:  = transactions.cid - Function: = count - Post: = - Value: = - Axis: =0 - Plot:= N - Resolve:= - Series Type:=Default - Popup:=Default - Prefix:= Measure 2 - Name: = Log - Measure:  = transactions.cid - Function: = count - Post: =log - Value: = - Axis: =0 - Plot:=Y - Resolve:= - Series Type:=Default - Popup:=Default - Prefix:= Measure 3 - Name: = lgdelta - Measure:  = transactions.cid - Function: = count - Post: =lgdelta - Value: = - Axis: =0 - Plot:=Y - Resolve:= - Series Type:=Default - Popup:=Default - Prefix:= #### Example use: Using lgdelta to calculate the difference in log values ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1679316009738.png) ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1679316019811.png)