Difference between revisions of "Grid Calculations"

Line 9: Line 9:
 
The {{Menu|Add Calculation}} option is available on the Grid's right mouse button pop-up menu. Alternatively, grid calculations can be added from the '''Row Calculation''' or '''Column Calculation''' menus in the Grid ribbon (visible when selected cell is on grid).
 
The {{Menu|Add Calculation}} option is available on the Grid's right mouse button pop-up menu. Alternatively, grid calculations can be added from the '''Row Calculation''' or '''Column Calculation''' menus in the Grid ribbon (visible when selected cell is on grid).
  
An empty calculation will be added below the current cell. The formula can be typed into any of the cells, and will be propagated to all the other cells in the row or column automatically.
+
An empty calculation will be added below the current cell. The formula can be typed into any of the cells, and will be propagated to all the other cells in the row or column automatically. Overtyping the title cell (defaults to 'Calc') will give the calculation a title.
  
 
Double clicking the title cell opens the Edit Grid Calculation dialog. This can also be accessed from {{Menu|XLCubed|Calculation|Edit Calculations}} right click option. In this dialog you can edit the title, number format and calculation position (see below).
 
Double clicking the title cell opens the Edit Grid Calculation dialog. This can also be accessed from {{Menu|XLCubed|Calculation|Edit Calculations}} right click option. In this dialog you can edit the title, number format and calculation position (see below).
Line 15: Line 15:
 
You can view, manage and deleting existing calculations in the {{Menu|XLCubed|Calculation|Manage Calculations}} dialog (also accessible through the Grid ribbon). A calculation can also be deleted by selecting the {{Menu|XLCubed|Calculation|Delete Calculation}} right click option.
 
You can view, manage and deleting existing calculations in the {{Menu|XLCubed|Calculation|Manage Calculations}} dialog (also accessible through the Grid ribbon). A calculation can also be deleted by selecting the {{Menu|XLCubed|Calculation|Delete Calculation}} right click option.
  
==Examples (based on the [[BicycleSales Demo Cube|Bicycle Sales cube]])==
+
==Example - Insert after slice==
 
''We want to see the difference between {{Code|2004}} and {{Code|2003}} in a Grid.''
 
''We want to see the difference between {{Code|2004}} and {{Code|2003}} in a Grid.''
 
<ol>
 
<ol>
<li value="1">Insert a Grid based on the Bicycle Sales demo cube, with the {{Code|Time}} hierarchy on columns</li>
+
<li> Right-click on {{Code|2004}} ({{Code|E5}}) and choose {{Menu|XLCubed|Add Calculation}} </li>[[File:GridCalculationsExample2.png|center|thumb|400px]]
<li value="2">Drill down {{Code|Time}}'s {{Code|All}} member by double-clicking on {{Code|B5}}: </li>[[File:GridCalculationsExample1.png|center|400px]]
+
<li>In the title cell ('''Calc''', {{Code|F5}}), type a name for the Calculation:</li> [[File:GridCalculationsExample3.png|center|400px]]
<li value="3"> Right-click on {{Code|2004}} ({{Code|E5}}) and choose {{Menu|XLCubed|Add Calculation}} </li>[[File:GridCalculationsExample2.png|center|thumb|400px]]
+
<li> In one of the column's data cells (for example, {{Code|F6}}) type the formula for the Calculation, {{Code|1==E6-D6}}.</li> [[File:GridCalculationsExample4.png|center|400px]]
<li value="4">In the title cell ('''Calc''', {{Code|F5}}), type a name for the Calculation:</li> [[File:GridCalculationsExample3.png|center|400px]]
+
<li> The Grid Calculation column propogate down onto all rows, even if the grid is drilled into or the structure of the grid is changed: </li>[[File:GridCalculationsExample5.png|center|400px]]
<li value="5"> In one of the column's data cells (for example, {{Code|F6}}) type the formula for the Calculation, {{Code|1==E6-D6}}. You may need to resize the column:</li> [[File:GridCalculationsExample4.png|center|400px]]
 
<li value="6"> The Grid Calculation column will now be used, even if the structure of the Grid is changed: </li>[[File:GridCalculationsExample5.png|center|400px]]
 
 
</ol>
 
</ol>
  
==More examples - Grid Calculations==
+
==Example - Insert at end==
  
This is how you can add a grid calculation that is not tied to members.
+
The grid calculation in the example above was tied to the {{Code|2004}} member. If that member no longer appeared in the grid (say, due to a slicer selection) then the calculation would also no longer appear.
  
A typical scenario would be a grid report that needs to show two different years on columns where the years can change.
+
It is possible to add a grid calculation that is not linked to a member but rather is always positioned at the end of the axis. This may be useful in a grid report that needs to show two different years on columns but where the years can change.
  
There are two methods to achieve the desired result: the first uses Excel functionality outside of the XLCubed grid, the second uses XLCubed grid calculation functionality referring to cell locations.
+
There are two methods to achieve this result: the first uses Excel functionality outside of the XLCubed grid, the second uses XLCubed grid calculation functionality referring to cell locations.
  
===Option 1: using Excel functionality===
+
===Using Excel functionality===
  
[[Image:GC1.png|350px|centre]]
+
To create a calculation at the end of the grid, select the relevant cell and fill in the formula.  
  
1. Use Excel to create a calculation outside of the grid – in this example enter formula in cell E6 as follows: =C6+D6
+
Right click on the grid and select {{Menu|XLCubed|Properties|Behaviour}} and check the 'Fill Formulae next to Grid' option. This will detect the grid's size and propagate any adjacent formula across the relevant amount of rows/columns. It may also be necessary to set the grid to 'shift' rows/columns so that the formula is not overridden on grid drills (see [[Grid Properties]]).
  
2. As you can see in the screenshot below, Excel has filled in the sum of C6+D6
+
For example, see the grid below with adjacent formula  {{Code|1==C6-D6}}
  
[[Image:GC2.png|350px|centre]]
+
[[Image:GC2.png|450px|centre]]
  
3. Right-click grid, Properties and on Behaviour tab check Fill Formulae next to Grid.
+
<ol>
 +
 
 +
<li>Right-click grid, Properties and on Behaviour tab check Fill Formulae next to Grid.
  
 
[[Image:GC3.png|350px|centre]]
 
[[Image:GC3.png|350px|centre]]
  
4. You can see the calculation has been done for all rows in grids.
+
<li>You can see the calculation has been done for all rows in grids.
  
[[Image:GC4.png|350px|centre]]
+
[[Image:GC4.png|450px|centre]]
 +
</ol>
  
===Option 2: using XLCubed Grid Calculations===
+
===Using XLCubed Grid Calculations with 'Insert At End'===
  
1. Add a grid calculation  
+
With this method, we can insert a grid calculation on rows/columns and change it's properties so that it is always positioned at the end of the axis.
 +
<ol>
 +
<li>Add a grid calculation  
  
  [[Image:GC5.png|350px|centre]]
+
  [[Image:GC5.png|450px|centre]]
  
2. Right-click to edit the calculation
 
 
[[Image:GC6.png|350px|centre]]
 
  
3. In the window above delete everything in the Value area and enter a formula that refers to the cell locations eg =C6+D6.
+
<li>Right-click to edit the calculation. Delete everything in the ''Value'' area and enter a formula that refers to the cell locations e.g. {{Code|1==C6-D6}}. The calculation default to ''Insert after slice'' - change this to ''Insert at end''.
  
 
[[Image:GC7.png|350px|centre]]
 
[[Image:GC7.png|350px|centre]]
  
4. Uncheck anything in the ''Attached to'' area and also select ''Insert at end''.
+
 +
<li>Select ok, and the calculation appears at the end of the columns axis, regardless of what years are being shown.
 +
 
 +
[[Image:GC4.png|450px|centre]]
  
[[Image:GC4.png|350px|centre]]
+
</ol>
 
5. The screenshot above shows that the calculation has been done for all rows.
 
  
 
==Member Selector and Adhoc Groupings==
 
==Member Selector and Adhoc Groupings==

Revision as of 11:13, 12 October 2018

Calculations can be added to any XLCubed grid and allow for users to create quick calculations that might not be contained in the cube. These calculations can use any standard Excel formula, from simple sums to complex vlookups, as well as XLCubed formulae and will be automatically propagated to all the other cells in the row or column. Grid calculations can be linked to grid members in order to respect drilling and swapping dimensions.

Video demonstration

Click here for videos showing grid calcualtions.

Creating and Managing Grid Calculations

The Add Calculation option is available on the Grid's right mouse button pop-up menu. Alternatively, grid calculations can be added from the Row Calculation or Column Calculation menus in the Grid ribbon (visible when selected cell is on grid).

An empty calculation will be added below the current cell. The formula can be typed into any of the cells, and will be propagated to all the other cells in the row or column automatically. Overtyping the title cell (defaults to 'Calc') will give the calculation a title.

Double clicking the title cell opens the Edit Grid Calculation dialog. This can also be accessed from XLCubed > Calculation > Edit Calculations right click option. In this dialog you can edit the title, number format and calculation position (see below).

You can view, manage and deleting existing calculations in the XLCubed > Calculation > Manage Calculations dialog (also accessible through the Grid ribbon). A calculation can also be deleted by selecting the XLCubed > Calculation > Delete Calculation right click option.

Example - Insert after slice

We want to see the difference between 2004 and 2003 in a Grid.

  1. Right-click on 2004 (E5) and choose XLCubed > Add Calculation
  2. GridCalculationsExample2.png
  3. In the title cell (Calc, F5), type a name for the Calculation:
  4. GridCalculationsExample3.png
  5. In one of the column's data cells (for example, F6) type the formula for the Calculation, =E6-D6.
  6. GridCalculationsExample4.png
  7. The Grid Calculation column propogate down onto all rows, even if the grid is drilled into or the structure of the grid is changed:
  8. GridCalculationsExample5.png

Example - Insert at end

The grid calculation in the example above was tied to the 2004 member. If that member no longer appeared in the grid (say, due to a slicer selection) then the calculation would also no longer appear.

It is possible to add a grid calculation that is not linked to a member but rather is always positioned at the end of the axis. This may be useful in a grid report that needs to show two different years on columns but where the years can change.

There are two methods to achieve this result: the first uses Excel functionality outside of the XLCubed grid, the second uses XLCubed grid calculation functionality referring to cell locations.

Using Excel functionality

To create a calculation at the end of the grid, select the relevant cell and fill in the formula.

Right click on the grid and select XLCubed > Properties > Behaviour and check the 'Fill Formulae next to Grid' option. This will detect the grid's size and propagate any adjacent formula across the relevant amount of rows/columns. It may also be necessary to set the grid to 'shift' rows/columns so that the formula is not overridden on grid drills (see Grid Properties).

For example, see the grid below with adjacent formula =C6-D6

GC2.png
  1. Right-click grid, Properties and on Behaviour tab check Fill Formulae next to Grid.
    GC3.png
  2. You can see the calculation has been done for all rows in grids.
    GC4.png

Using XLCubed Grid Calculations with 'Insert At End'

With this method, we can insert a grid calculation on rows/columns and change it's properties so that it is always positioned at the end of the axis.

  1. Add a grid calculation
    GC5.png


  2. Right-click to edit the calculation. Delete everything in the Value area and enter a formula that refers to the cell locations e.g. =C6-D6. The calculation default to Insert after slice - change this to Insert at end.
    GC7.png


  3. Select ok, and the calculation appears at the end of the columns axis, regardless of what years are being shown.
    GC4.png

Member Selector and Adhoc Groupings

Users can quickly add custom groupings into their reporting, with the calculations then available for selection from the member selector across all grids and formulae sharing the same cube connection within the workbook. This is done on the right click menu in the member selector as shown below:

GridCalc1.png
GridCalc2.png


  1. Choose the members to group, and select group members.
  2. Then name the grouping as required, and choose the parent element which the group is to appear under.
GridCalc3.png


The new element will appear as a custom calculation. If you wish to amend or delete it, select the custom calculation tab on the XLCubed ribbon.

GridCalc7.png

Measure to Base: Calculated Values on Measures

For measures, users can add a calculation which will show percentage contribution to specific levels in a chosen hierarchy. This is available in the member selector for measures, on the right click menu as shown below.

In this example a calculation is added to show the Reseller sales amount as a percentage of the parent at the country level in the Geography hierarchy.

See MDX formula wizard for more information on this dialog.

GridCalc4.png
GridCalc5.png
GridCalc6.png

Pareto Columns (new in v7.2)

The Pareto Principle is often referred to as the 80-20 rule, that 80% of outcomes are attributable to 20% of causes. They are named after Vilfredo Pareto who lived in Italy in the 19thcentury and observed that 80% of the land was owned by 20% of the people. Pareto charts have both bar charts and a line graph where the bars represent individual values and the line represents the cumulative total.

To use Pareto Charts from XLCubed, within a grid, right-click on the column header to access XLCubed’s right-click menu, Grid Charts and Add Pareto Analysis.

Take this simple grid showing Reseller Sales for Product Model Categories for Canadian cities:

P1.png

Right-clicking on All Products to Add Pareto Analysis brings up this window:

P2.png

Click OK to return to the workbook and you will see that we have a chart showing that the top 9 cities provide some 80% of the sales.

P3.png

You could also include the rolling total and percentage in your Pareto Chart.

Notice that we now also have some extra columns on the grid showing the cumulative total of all sales, the sales percentage per category and the cumulative percentage.

P4.png

So that's Pareto Charts - in a nutshell, an easy to use graphical tool which ties directly into dynamic XLCubed grids.

Fixed Position Calculations (new in Version 8)

By default grid calculations are pinned to specific members of the hierarchy. This means that the calculations can be highly dynamic, appearing in the grid wherever the pinned member does, even after the member moves due to drilling or slice and dicing. Sometimes it can be useful to have a 'static' calculation, which is always in column 3 for example, irrespective of what members are chosen in the grid. A scenario would be that you choose a year in a slicer, and the quarters within that year are shown in the grid. You may want to always show the difference between Q2 20XX and Q1 20XX, irrespective of what year is chosen and version 8 enables this by providing 'unpinned' calculations which are inserted at a fixed position. Using this approach the calculation will always appear in the specified row or column irrespective of which other members are chosen.

GridColAtPos.png

To use this approach, insert the calculation as normal, and once inserted right click on the title to edit the calculation. You can now choose 'Insert at Position' and specify the column or row. On exiting the dialog type in your formula and it will be treated as a literal Excel cell reference rather than pinned to the members in the cube.

Fixed Axis Calculations (new in Version 9)

Fixed position calculations from v8 are still attached to the hierarchies on the axis. In some cases you may want to be able to swap the hierarchies on Columns, and still have the fixed position calculations appear.

This is possible in v9, in the edit dialog you can now specify that the calculation is fixed on the axis, not the hierarchies.

GridColAtPosAxis.png

Time Calculations (new in Version 9.1)

Common time calculations such as Year to Date (YTD), Month to Date (MTD), Rolling total and Previous Period can easily be created using the calculation wizard, there are more details on the MDX formula wizard page.