New Calculated Field in Dynamic Calculator

<< Click to Display Table of Contents >>

Current:  Create Calculated Field 

New Calculated Field in Dynamic Calculator

Previous pageReturn to chapter overviewNext page

The dynamic calculator means that the value of each grid is calculated dynamically, and it can also be called a grid calculation. The main solution is to dynamically calculate the values in a specific direction in the table. There are two elements, namely the calculation direction and the calculation method (or function).

The direction of calculation is related to the structure of the table. If you want to do ring calculations for product quarterly increments, you need to group the product fields and quarter fields along the quarterly field. We call a group a partition. What direction is called based on the Addressing.

The calculation function includes the difference, the percent from, the percent difference, the percent of total, and the running total and the moving calculation. Each calculation function has some special properties and parameters.

Users can also customize the calculation function and calculation direction according to their needs. For a custom calculation function, you can also use the properties of the second calculation, that is, the current dynamic calculation can use the results of other dynamic calculations to do a second calculation.

The purpose of this chapter is to introduce how to customize calculation functions through scripts.

 

Open Calculated Field dialog  of dynamic calculator

Choose Add Dynamic Calculator in the drop-down list of measure of table, pivot and chart, as shown in the figure below.

Calculated13

In the Dynamic Calculator dialog, select Customized as shown below.

Calculated14

 

Then open the Calculated Field dialog, as shown below. The user can invoke the fifteen dynamic calculation functions provided under the Dynamic Calculation folder. For a detailed description of dynamic calculation functions, see dynamic calculation script function.

Calculated15

[Name] is the name of the data field.

When the user uses the function for dynamic calculation, click the OK button to enter the dynamic calculation dialog again. In this dialog , the user can set the direction of dynamic calculation. When the user needs to edit the expression again, click the Edit button, then the expression can be edited again.

Calculated16

 

[Secondary] That is, this dynamic calculation expression involves another calculated field. For example, there is a dynamic calculation field with the name movingAVG, when the user uses the movingAVG in the another calculated field, such as the expression movingMin(col['movingAVG'], 2,2, true, true) shown below, it belongs to the secondary dynamic calculation. In this case, the user needs to check the secondary calculation option.

 

Calculated17

Application examples

There is a table as shown below.

Calculated18

 

When the user needs to calculated the accumulative total of each type, the runningSum() function can be called. The statement is runningSum(Sum(col['profit']), col['sale_type']);

Calculated19

The result of the calculation is shown in the figure below.

Calculated20