官术网_书友最值得收藏!

Time for action – calculated members

Calculated members help to perform calculation based on measures, dimension hierarchies, and MDX functions. They are very helpful for covering business requirements with the help of a cube. In this example, we will create a new calculated member for Profit.

  1. In the cube designer, go to the Calculations tab.
  2. Create a new calculated member by clicking on the button that is magnified in the next screenshot.
  3. Rename the calculated member to [Profit].
  4. Write the following expression in the Expression field:
    [Measures].[Sales Amount] - [Measures].[Total Product Cost]
  5. Set the format string as "Currency".
    Time for action – calculated members
  6. Deploy and process this procedure, and then browse the cube with the Product Category hierarchy and a Profit measure.

What just happened?

In this extremely simple example, we created a profit column based on the total product cost and the sales amount. The MDX expression used here is very simple; as you can see, you don't need to write the whole select statement, you just need to write the expression that calculates or applies conditions.

The MDX expression can be made more complex with the help of functions and metadata information listed in the bottom-left side of the preceding screenshot. You can drag-and-drop functions or measures or dimension hierarchies in the expression box and create the expression easily. There are also some properties for calculated columns, such as font, color, and format string, which can be set in this window.

You can also create Named Sets in this window, which can be a subset of the dimension attribute members, for example, a list of the top 50 customers based on the sales amount. You can write MDX scripts to create a Named Set again.

As you've seen in this section, MDX plays an important role in creating calculations and writing complex query scripts on the SSAS Multidimensional cube, so our recommendation for SSAS developers is to improve their MDX skills. The more professionally you can write MDX, the better you will be able to create more powerful cubes for business requirements.

主站蜘蛛池模板: 襄樊市| 若尔盖县| 靖江市| 丹江口市| 临安市| 阜新| 永丰县| 格尔木市| 华坪县| 万年县| 绵竹市| 花莲县| 平原县| 延川县| 沧州市| 鄱阳县| 沈丘县| 清丰县| 莒南县| 白玉县| 湛江市| 扶沟县| 长丰县| 庄河市| 松原市| 玛纳斯县| 邮箱| 曲松县| 武定县| 平邑县| 濮阳市| 思茅市| 康平县| 随州市| 长寿区| 垦利县| 拜城县| 溧阳市| 琼海市| 南涧| 鱼台县|