Adding Extra Crosstab Values
By default, the Crosstab Filter produces a single value for each column and row combination. In order to generate additional values for the Total Sales data for our crosstab table, we need to use an Extra Crosstab Value Column element.
As shown above, this element simply identifies a column from the datalayer ("OrderTotals") and the aggregation to be applied to it.
A Crosstab Table Value Columns element ("colOrderTotal") is also added to display the values.
A special token is needed to access that data: @Data.rdCrosstabValue-ODTotal~.
The token identifier combines the reserved word "rdCrosstabValue", then a dash "-", and then the ID of the element beneath the Crosstab Filter that represents the value column ("ODTotal"). This token is used in the Caption attribute of a Label element beneath
the Crosstab
Table Value Columns element we added.
Next, we'll repeat the previous steps in order to add an Average Unit Price column, this time using an Extra Crosstab Calculated Column element. In the example shown above, the average unit price is calculated using this element. The complete formula in this example is:
@Data.rdCrosstabValue-ODTotal~/@Data.rdCrosstabValue~
which divides the Order Total by the Quantity. The Order Total value is accessed using the same token discussed earlier and used to display the order total values; while the Quantity value is accessed using a similar token representing the original Value column defined in the Crosstab Filter.
The elements added and configured in this step add the columns highlighted above.
And, in a Preview, the table now looks like the image shown above.