Creating a calculated column in a PixelPerfect report
You can create a calculated column in a PixelPerfect report by creating a formula that uses data from available fields. Note that formulas are calculated during report generation. If this takes too long, we recommend moving the value calculations into the QlikView script.
Create new PixelPerfect report
Do the following:
- Select Reports in the Qlik NPrinting main menu, and then click Create report.
- Enter a Title for the report. PixelPerfect report with a calculated column.
- Select PixelPerfect from the Type drop-down list.
- Select an app from the App drop-down list.
- Click Create to create the report.
- Click Edit template to open the Template Editor.
- Right-click the Levels node, and select Add levels.
- Select the Connection to the QlikView document that contains the object you want.
- Select CH184.
Add calculated field
In this example, you will create the cost column by calculating the difference between total sales and gross profit. You can use the formula editor to create more complex formulas.
Do the following:
- Right-click the CH184_Level, and then select Add Calculated Field from the drop-down list.
- Enter Cost as the name in the Property Grid.
-
Click the browse button at the extreme right of the Expression field.
The Expressioneditor appears.
Enter the expression
Do the following:
-
Click Fields in the left column.
The list of available fields appears in the center column.
- Double-click Total Sales to insert it into the expression.
- Click on the - symbol, or type it.
- Double-click Gross Profit to insert it into the expression.
- The final expression is [Total Sales] - [Gross Profit]
-
Click OK.
The calculated column, Cost, appears at the top of CH184_Level list of fields.
Create a table with CH184_Level
Do the following:
- Right-click the Detail bar.
- Select Insert Detail Report.
-
Select CH184_Level.
The result is the DetailReport1 - CH184_Level bar.
Create table cells
Do the following:
- Press the Ctrl key and select the following fields in order:
- ProductName
- Total Sales
- Gross Profit
- Cost
- Left-click the selection
- Drag and drop the selection into the DetailReport - CH184_Level - Detail1 band.
- Drag and drop the lower dashed line upward to the Detail1 bar, to eliminate the white space.
Format the CH184_Level cell
After clicking the desired cell, do the following:
- Click the smart tag, which is the small arrow above the upper right corner of the cell.
- Click the browse button at the extreme right of the Format String field.
- Select Currency.
- Click $0.00 from the list.
- Click OK.
Preview and save
Do the following:
- Click Preview.
- Check the report, close it, and then edit the template again if necessary.
- Click Save and Close to save the template and close the Template Editor.