Optimizing Microsoft SQL Server Analysis Services: Optimize Query Performance with a Derived Measure
17. In the Data view, reposition the row axes, if necessary, so that the row headings display the Store Type / Promotion Name combination we set up earlier.
18. Scroll over in the Data view until the columns headed CM_Cost with Promo Alloc and DM_Cost with Promo Alloc appear, as depicted in Figure 22.
Figure 21: Aligning the Derived and Calculated Measures for Comparison in the Data View
Side by side, we can see that the derived measure appears to return the same value as the calculated measure, with two exceptions – both of which add to the desirability of the derived measure as a solution. First, there is a difference in the “All Promotions” value, atop the Promotion Name rows. This is due to the correct exclusion, by the derived measure, of the “No Promotion” promotion row from the fifteen percent uplift calculation. (Test the math, if desired).
The other difference is the placement of the zeros in the new derived measure column, which is a result of our “outer IIF” statement. The statement prevents an error that would be indicated were it not in place. (We could replace or hide the zero easily enough, but for this session, let’s leave it in place.)
19. Drill further or otherwise experiment with the derived measure to get a comfort level with its accuracy, if desired.
We will now eliminate the calculated measure, CM_Cost with Promo Alloc, as the derived measure has been verified to meet the business requirements (enhanced query performance and accurate results) specified by the information consumers.
20. Right-click the CM_Cost with Promo Alloc calculated measure, within the tree pane of the Calculated Members folder.
21. Select Delete from the context menu that appears, as shown in Figure 23.
Figure 23: Deleting the Calculated Measure …
The calculated measure disappears from the tree pane.
22. Select File —> Exit to leave the Cube Editor, when ready (saving the cube, if prompted).
We are returned to the Analysis Manager console.
23. Select File —> Exit to leave Analysis Services, when desired.
In this article, we explored the use of derived measures to enhance cube query response time. Discussing the drawbacks in using calculated members in cases where a derived measure might be substituted, we considered the benefits and disadvantages that might accrue through the use of derived measures. We then began a practice exercise, the preparation for which involved the creation of a simple calculated measure, which we used to serve as the “existing,” less-than-optimal solution that had already been provided to our hypothetical group of information consumers. The calculated measure served as a basis for comparison with our more optimal solution, the derived measure.
We described the requirement of the information consumers to enhance query response time, and, in answer to their need, we determined that a derived measure might best be substituted for the existing calculated measure. We then implemented our solution through creation of a derived measure to replace the existing calculated measure. Finally we discussed the results obtained, verifying the values provided by our solution against those produced by the calculated measure, before eliminating the latter from the cube.
Copyright 2004 by the author.