Overview
Note: You are advised to calculate the proportion by the PROPORTION function in FineReport 11.0.4 and later versions.
Application Scenario
The proportion refers to the ratio that an individual datum occupies in the total amount.
For example, the following figure displays the proportion of the quarterly production of the petrol, kerosene, and diesel in the total production.
Implementation Method
1. You can calculate the proportion by the PROPORTION function.
2. You can calculate the proportion by the formula C2/SUM(C2[!0]).
Example
Data Preparation
Create a general report, and create a built-in dataset named ds1, as shown in the following figure.
Table Design
1. Drag the fields in ds1 into cell A2, cell B2, and cell C2 respectively. Cell D2 is used to calculate the proportion.
Enter =C2/SUM(C2[!0]) in cell D2. The following table illustrates the formula in detail.
Formula | Description |
---|---|
SUM() | Returns the total of all the data in the bracket. |
C2[!0] | Returns all the data of all cells expanded from cell C2. |
C2/SUM(C2[!0]) | Returns the proportion that the value of cell C2 occupies in the total value of all cells expanded from cell C2. |
2. Select cell D2, click the Cell Element icon on the right, and select Percentage from the drop-down list of Format.
Effect Display
Save the report, and click Pagination Preview. The following figure shows the preview effect.
The report can be previewed on the DataAnalyst APP and HTML5 terminal, as shown in the following figure.
Template Download
For details, you can click to download Proportion.cpt.