Creating Computed Columns

When looking for answers to basic business questions, raw data cannot always provide the information. For example, while a database might track sales figures, sometimes this information is much more valuable with reference to more complicated calculations such as cost of sales or profit margins.

You can anticipate these requirements, designing the internal database structure so that it makes such calculations as the raw data is collected. But at times you might not find the exact information you need because no one has needed it before. That is where Computed data items are most useful. You use these items to generate new information, usually from data that is already stored in the database. If the database does not offer this information, you can use Interactive Reporting to compute it.

Note:

Equations in the Report section are written in JavaScript syntax. When creating new data item columns, the Computed Item dialog box is not used. Instead, equations are defined in the Expression Line.

  To create a computed column:

  1. Build a Tabular report.

  2. Drag an item from Elements to the Table Facts pane of the data layout.

    You cannot modify items added to the Table Dimensions pane of the data layout. Either add an item to the Table Facts pane or modify the item in the Results section.

    When selecting an item from the Catalog, select an item that is part of the equation for the computed item. For example, if Unit Sales is part of the equation, then drag Unit Sales to the Expression bar.

  3. Define the expression in the Expression Line.

    Undock the Expression Line and resize the window if the equation extends beyond the viewing portion of the window.

    Change the data function applied to the item by selecting another data function from the pull-down list on the Expression Line.

    To apply an arithmetic equation to the expression, enter the applicable operators.

    Drag additional items from Elements to the Expression Line as needed. The JavaScript syntax for items are generated automatically.

  4. When the equation is complete, click the green check mark on the Expression Line.

    The equation is calculated and the values are displayed in a column in the table.

In the following example, the report determines which Store Managers receive $2,000 and $3,000 bonuses. A Level 1 Bonus of $2,000 is granted if the store's revenue exceeds $5,000.00. A Level 2 Bonus is granted if the store's revenue exceeds $10,000.00.

Image show store mangers who receive $2.000 and $3,000 bonuses.