Process the project so that the cube is deleted on the server as well. You can do this

Một phần của tài liệu Pro SQL server 2012 BI solutions (Trang 475 - 480)

click oK to close the New Measure dialog window.

7. Rename both members by removing the spaces that the designer has added to their names.

8. Verify that both new measures have been added to the Sales measure group, which should now look similar to Figure 11-45. These are now in the DWPubsSalesVer1 cube and not the DWPubsSalesForTesting cube.

At this point, you have created a new derived measure for your cube that you can use in your reports.

Although the calculated member did not work in this particular case, it will often work just fine and is a useful tool in many cubes.

in this exercise, you created a testing copy of our cube. You then created both derived and calculated measures and verified which one of these new measures was correct. Finally, we move the derived member to the cube we are currently working on, DWPubsSalesVer1. Now we need to continue configuring our cube by moving to the next tab, which allows us to include KPis.

KPIs

A key performance indicator (KPI) is a way of grouping measures together into five basic categories. The five basic categories start at -1 and proceed to a +1 using an increment of ( -1, -0.50, 0, +0.50, and +1). The numbering system may seem odd to some, but it has to do with the science of statistics. Because of this, SSAS uses only these five categories, and they cannot be redefined.

The idea behind a KPI is for you to reduce the number of individual values in a tabular report to the essence of those values. This is convenient when you have a large report and what you really want to see is whether something has achieved a predefined target value, exceeded it, or did not make it to that value.

KPIs can be created in programming code such as SQL, C#, or MDX. In Listing 11-4 , you can see an example of an MDX statement that defines a range of values and categorizes each value within that range as either -1, 0, or 1. To keep things simple, we excluded the .05 and -05 categories and will work with just these three categories for now.

Listing 11-4. MDX Statement That Groups Values into Three KPI Categories WITH MEMBER [MyKPI]

AS case

when [SalesQuantity] < 25 or null then -1

when [SalesQuantity] > = 25 and [SalesQuantity] < = 50 then 0 when [SalesQuantity] > 50 then 1

end SELECT

{ [Measures].[SalesQuantity], [Measures].[MyKPI] } on 0, { [DimTitles].[Title].members } on 1

From[CubeDWPubsSales]

The categorization comes from the MDX Case expression where the values of sales quantity are divided into the three categories of less than 25, 25 to 50, or more than 50. We chose this range at random for our example, but the range you choose for your BI solution should be based upon a range that has some significance to the business you are building it for.

In the cube designer window, you can include an MDX expression using the KPI tab, as shown in Figure 11-46. On the KPI tab, click the new KPI button (circled in Figure 11-46), and a new KPI will appear under the KPI organizer pane. Rename the KPI to something descriptive that has no spaces by typing the new name in the Name textbox. In our example, we have named it SalesQty25To50KPI.

Beneath the Name textbox is the “Associated measure group” dropdown box. This identifies which measure group the KPI belongs to. In our example, we picked the Sales measure group.

Beneath the dropdown box is the Value Expression textbox. Indicate which measure or MDX expression you want to evaluate in this box. In our example, we evaluate the measure SalesQuantity.

The Goal Expression textbox allows you to type a description that will appear in some client applications such as Excel. This is to give your end users a better understanding of what the KPI describes.

The status indicator dropdown box allows you to choose between several icons that come with SSAS. These icons represent suggestions as to what should be displayed to client applications in a report using the KPI. Until recently, most clients ignored these settings. But newer versions of Excel can read them from SSAS and display an icon that looks very similar to the one suggested.

If a client application (such as Excel) does not have an icon that looks exactly like the SSAS icon, it will use another one. These can be adjusted on the client application. When an application is unable to read the suggested icon from SSAS, the report builder will have to determine which icons to use on their own.

The Status Expression textbox is where the MDX expression is placed to create the KPI value categories. Notice that this is not a full MDX statement. Instead, it shows the expression that evaluates as the KPI categories of -1 to 1.

More settings can be configured, but these are the core settings necessary to create a KPI. Once you have defined these settings, you can review the output of the KPI by switching to the browser view. To switch between the browser view and the form view of the KPI tab, toggle between the two toolbar buttons circled in Figure 11-47.

Once you switch to the KPI browser, Visual Studio will display the KPI based on the grand total of the value expression. Our value expression is the sales quantity, and the grand total is 493. It displays this value in the Value column in the results section.

Figure 11-46. Adding a KPI to your cube

Figure 11-47. Reviewing the KPI results

Important

■ A cube must be processed before Visual Studio can display the results. The reason for this is that the data is not derived from the XML files in Visual Studio but rather from the database on your SSAS server. Notice that the Reconnect button is available on the KPi tab just as it is on the cube browser tab. You can use this to reconnect to your server after the cube has been processed.

The number 493 is greater than 25 to 50; therefore, the status indicator is an upward-pointing arrow. This particular result is somewhat meaningless, because what we would really like to see is how a particular title fared within that sales quantity range. To adjust this, we need to filter out the value that we want to test from the cube.

We can do this by defining the dimension hierarchy operator and filter expression just above the results pane, as shown in Figure 11-48. Each of these columns holds a dropdown box allowing you to choose which item to use.

By selecting a dimension hierarchy operator and a particular title, we can see what category of sales quantity that particular title falls under.

The end user does not have this restriction. Applications such as Reporting Server and Microsoft Excel can display the KPI values for all titles at once, as shown in Figure 11-50. (Notice that the icons in this figure are not an exact match for the icons used in SSAS. This is because Excel has its own set of icons and reads the suggestions that you have configured on SSAS only to determine which icons should best be used.)

Once you have chosen a particular title, clicking back in the results pane refreshes the screen and displays your KPI value (Figure 11-49). Sadly, this tool shows you only a single report value at a time, but you can check the first three titles by changing the filter expression one title at a time.

Figure 11-49. Viewing the filtered KPI results

We talk more about making Excel reports in Chapter 15, but for now let’s create a KPI for our cube in the following exercise.

Một phần của tài liệu Pro SQL server 2012 BI solutions (Trang 475 - 480)

Tải bản đầy đủ (PDF)

(823 trang)