Insert calculated rows

Inforiver provides an option to insert calculated rows using an intuitive formula editor. The Excel-like formula engine supports 50+ functions (logical, boolean, math functions and more). The formula editor provides syntax, examples and features such as autocomplete, multi-line support and more to help users create, and troubleshoot formulas.

Refer to formula syntax for a detailed list of functions, operators, and identifiers that can be used for calculations.

Let us take this example, where we have sales data by category and subcategory. Let's insert a row for Specialty Beverages which is calculated as the minimum of the other subcategories in Beverages across quarters.

Sales report

a) Select the Tea & Coffee row above which we need to insert the row. In the 'Insert' tab, click on the 'Insert row' dropdown. Click on 'Calculated row'.

Inserting a calculated row

b) A blank row gets inserted and a side panel opens up as shown.

Calculated row side panel

1. Formula editor

a) Rename the title and click on the formula editor. You can see a list of available functions in the 'Functions' tab.

Using functions

b) As you start typing, the list of functions narrows down to match the entered text. Click on 'Min'.

Formula editor

c) You can see the syntax for the function. Click on the arrow highlighted.

Formula syntax

d) You can see an explanation of the arguments and examples.

Formula syntax and examples

e) To insert a particular row, you can simply click on it when the cursor is placed in the formula editor.

Inserting references by clicking a row

f) The other way is to use the 'References' tab. To access Soda, you need to type Beverages.Soda. As you start typing, the references get narrowed down. Select 'Beverages'.

Inserting a reference from the dropdown

g) Type a '.' after Beverages and select 'Soda' from the dropdown.

Traversing a hierarchy

h) Finish typing the formula as shown below.

Formula entered

To see the underlying logic for calculated data, click on the cell to preview the formulae applied in the formula bar.

While you can use the SUM and AVERAGE functions to calculate the sum and average of rows respectively, you can also use the Insert Sum of rows and Insert Avg of rows options from the 'Insert Row' menu.

Select the desired rows first holding down the Ctrl key and then select Insert Sum of rows.

Choose Insert Sum of rows

A new row containing the sum of the selected rows is created as shown below. You can use the side panel to make any additional changes. Observe how the formula editor has been automatically populated with the selected rows.

New Calculated Row - Sum

Similarly, for calculating and inserting the average of rows, use Insert Avg of rows.

Any errors in the formula can be easily located with clear and concise error messages. In the maximized formula editor view, you will also notice line numbers, allowing you to quickly locate and fix errors.

Fixing errors in formula

2. Include in total

a) Check the 'Include in total' checkbox as we need the Specialty Beverages value to be included in the Beverages total and the grand total. Click 'Create'.

Including calculated row in total

b) You can see that the row is renamed and the values are populated. There is also a formula bar on the top which shows the formula defined.

Note that the grand total is now updated to 255m.

Calculated row inserted

c) Let's uncheck the 'Include in total' checkbox and click 'Update'.

Excluding Specialty Beverages from total

d) You can see that the grand total has now reverted back to the original value of 239m.

Specialty Beverages excluded from total

3. Include in charts

a) Check the 'Include in charts' checkbox and click 'Update'.

The 'Include in charts' checkbox is enabled only when the 'Include in total' option is unchecked.

Include in charts

b) Let's now add a bar chart to 2022 Actuals. Click on the column and select the highlighted bar chart from the 'Home' tab.

Adding a bar chart

c) Notice that the Specialty Beverages row is also visualized using the bar chart.

Bar chart shown for calculated row

d) On unchecking the 'Include in charts' checkbox and clicking 'Update', you can see that the calculated row is no longer shown as charts.

Calculated row shown as numbers

4. Evaluate column before rows

When inserting calculated rows, in some cases you might want the total to be the sum of the child columns whereas in other cases, it needs to follow the defined formula. This behavior can be configured using the 'Evaluate column before rows' option.

Let's consider an example where we are inserting the relative variance between two rows. In the below image, with 'Evaluate columns before rows' enabled, you can see that the variance for the grand total is calculated based on the grand total values of Pacific and Central.

Total value calculated based on formula

When 'Evaluate columns before rows' is disabled, the grand total variance is calculated as the sum of Beverages and Water which is not the expected behavior in this case.

Total value calculated as sum of category values

5. Custom scaling

In certain cases, the values in calculated rows may not conform to the number scaling set at the report level. You can apply a custom scaling factor based on the nature of the calculation applied.

Scaling Factor

6. Bind for Cross filter/RLS

You can enable the Bind for Cross filter/RLS option – this ensures that cross-filter selections and RLS settings apply to calculated/manual input rows that reference other rows. For example, if this option is not enabled, a manager handling Canada accounts can view a manually inserted row that references US data or an inserted region that is manually created at the visual level.

You can bind inserted rows by selecting a reference row or a dimension category.

  • Binding by selecting a row

To select a particular reference row, choose Row from the SelectionType dropdown. The Alaska>Inforiver hierarchy references the Canada row in the example below.

Bind by row selection

The Alaska hierarchy is displayed for users with RLS access to Canada data.

Row binding for RLS
  • Dimension category

To bind the inserted row to a particular dimension category, choose Dimension member from the SelectionType dropdown. In the example below, the Paseo adjustment row references the Paseo product.

Bind to dimension category

Notice how the adjustment row is displayed for users with access to Paseo products.

Adjustment row dispayed for Paseo products

Resources

Insert Formulas, Columns and Aggregation

Visual calculations using Inforiver

Implement SUM measure totals in Power BI (without using DAX)

Excel-like MoM, QoQ, YoY % Calculations in Rows in Power BI

Last updated