Adding calculations to cubes
In the previous chapter, you learned how to write simple MDX statements; in this section, we will use that knowledge to extend the FirstCube
cube that you have worked on. As covered before, MDX is a language that is used when querying cubes, but it can also be used to define objects in your cube.
In the cube designer you a have tab called Calculations; here you can add different types of calculations such as measures, named sets, and time calculations.
Simple calculated measures
To create a simple calculated measure such as a margin (the difference between revenue and cost) calculation, perform the following steps:
Click on the New Calculated Member button in the cube designer.
Name the measure as
[Margin]
and add the following expression:[Measures].[Sales Amount]-[Measures].[Total Product Cost]
Specify that the format string should be
Currency
.Select the associated measure group to be Fact Internet Sales.
Deploy the cube.
Note
When you add new calculations, you do not...