You can create calculated fields from fields in the data source. You can also build calculated fields from other calculated fields.
When you create a calculated field, the field appears in the Calculated Fields list. The function determines the values.
You can add calculated fields to columns or groups. This helps you build richer reports.
Generic functions like now() or 2+5 cannot be added to an empty layout. Add at least one column or group from a data source field first.
now()
2+5
Calculated fields do not support these options:
Filter
Prompt
Sort
Aggregation
Open the report where you want the calculated field.
Select the Data tab.
Scroll to the bottom of the tab.
Find Calculated Fields.
Select the plus sign next to Calculated Fields.
The Create Calculated Field dialog appears.
Set the values you need:
Display Name: Name shown in the report.
Category: Function category.
Select Fields: Fields you can insert into the formula.
Functions: Double-click a function to insert it into Formula.
For common formula functions, see the Pentaho Report Designer documentation.
Formula: The expression used to calculate values.
Data Format: Data type for the field.
Numeric
Date
Other
Description: Description of the selected function.
Return Type: The function return type.
Example: SUM(2, 3) returns an integer type.
SUM(2, 3)
Example: CONCATENATE("A", "B") returns a string type.
CONCATENATE("A", "B")
Select OK.
The calculated field is added to the list in the Data tab.
Right-click the calculated field for these actions:
Edit: Edit the calculated field formula.
Delete: Delete the calculated field.
Add To Report: Add the calculated field to columns in the layout.
Add To Groups: Add the calculated field to groups in the layout.
Last updated 1 month ago
Was this helpful?