Showing posts with label Analysis Services. Show all posts
Showing posts with label Analysis Services. Show all posts

Sunday, September 6, 2015

Upgrade PowerPivot Data Model to SSAS Tabular

In the previous articles, I discussed the steps for building PowerPivot data models for Dynamics GP Sales and Financial (GL) data using PowerPivot for Excel. This is a great way for power users to build powerful business intelligence solutions without expensive hardware and difficult to use development tools. It is also a great way for professional BI developers to prototype a complete solution quickly.

However, there will be situations where PowerPivot based solutions may not meet your business needs. In this case, there are two upgrade paths available to migrate your PowerPivot data model. These are PowerPivot for SharePoint and SSAS Tabular. In this article, I will discuss SSAS Tabular.
Here are some of the reasons why you may want to upgrade from PowerPivot to SSAS Tabular.
Security
Tabular model databases can use row-level security, using role-based permissions in Analysis Services. For example, you can configure security to enable Sales Manager to view all sales data while Salesperson to view only his or her sales data.
Power Pivot workbooks are secured at the file level. A user who has access to the file can view all the information contained within the workbook.
Scalability
PowerPivot for Excel has an artificial file size limit of 2 gigabytes, which is imposed so that workbooks created in Power Pivot for Excel can be uploaded to SharePoint, which sets maximum limits on file upload size. One of the main reasons for migrating a Power Pivot workbook to a tabular solution on a standalone Analysis Services instance is to get around the file size limitation.
Partitioning
Partitions, in tabular models, divide a table into logical partition objects. Each partition can then be processed independent of other partitions. For example, a table may include certain row sets that contain data that rarely changes (historical sales data, for example), but other row sets have data that changes often (current year’s sales data).
Query and Reporting
Excel and PowerView are your only options if you use PowerPivot. With SSAS Tabular, you can use many other reporting tools including SQL Server Reporting Services (SSRS).
You will find detailed comparison of SSAS Tabular and PowerPivot here.
Before you upgrade your PowerPivot data model to SSAS Tabular, you will need the following:
  1. SQL Server Analysis Services instance running in Tabular mode (I used SQL Server 2014)
  2. SQL Server Data Tools (SSDT) (This is required if you use Visual Studio to import your data model to SSAS Tabular. Please see below for details)
There are two ways you can import your PowerPivot data model to SSAS Tabular.

Option 1:
SQL Server Management Studio option: Import directly to SQL Server using Restore from PowerPivot option as shown in the following screenshot


Option 2:

Visual Studio (SSDT) option: Import using Visual Studio (SSDT) as shown in the following screenshot
Once completed, you will be able to connect to the SSAS Tabular data model on the server and create a report in Excel and other reporting tools such as SSRS.
Here’s the PivotTable created using Excel. You will notice that the presentation of PivotTable fields is slightly different from what you see when you create a PivotTable from PowerPivot data model. For example, KPIs have their own folder. However, the end result is the same.

Because the data is no longer stored within the Workbook but is stored on the server, the file size is very small as shown in the following screenshot.





After you have migrated the PowerPivot data model to SSAS Tabular, you do not need the original Excel workbook any more. You will need to use Visual Studio to make changes to the Tabular data model and implement new features such as security and partitioning.

If you would like to learn more about SSAS Tabular, you will find step by step tutorials here.

Saturday, January 10, 2015

Lead Scoring using SQL Server Analysis Services and Excel

Sales and Marketing departments at many companies use lead scoring to determine sales readiness of leads. At a high level, lead scoring involves the following steps:

  • Identify key factors that influence customer’s purchasing decision
  • Determine relative impact of each factor on the purchasing decision
  • Formulate lead scoring rules using the above information
  • Determine a score threshold required for a lead to be identified as sales ready
Key factors that may influence a lead’s purchasing decision depend on the product or service being offered and may include any of the following:
  • Demographic attributes such as gender, marital status, home ownership, income, number of children, location, etc.
  • Online behavior such as web inquiries, number of visits to a web page, clicks in response to an email campaign, etc.
  • Lead source including search engine, marketing campaign, trade show, etc.
Leads above the pre-determined lead score threshold are converted into qualified opportunities and pursued further. Also, depending on the score, a lead may be assigned to appropriate sales resources. For example leads with the score above 500 may be assigned to a senior salesperson whereas leads with the score between 200 and 300 may be assigned to telemarketing. Leads between the score of 100 and 200 may be included in a nurture campaign.
Often, sales and marketing departments collaborate to develop a lead scoring model based on their past experience with customers’ purchasing behavior and industry knowledge.
If you have sufficient historical data related to past wins and losses and customers’ demographics, lead source and online behavior, you can mine this data to determine scoring rules and score threshold.
Microsoft offers an Excel based toolset called Table Analysis Tools for Excel which includes Prediction Calculator.
To use the Table Analysis Tools for Excel, you must first create a connection to an instance of Analysis Services installed in Multidimensional server mode. This connection gives you access to the Microsoft data mining algorithms that are used to analyze your data. (Note: The tools will not work with Tabular server mode).

The following screenshots illustrate the sample input data included with the toolset and the output produced by the Prediction Calculator. 
Sample Input Data:


The table in the screenshot above includes demographic data of bike buyers and whether they purchased a bike or not (last column).
Based on this data, the tool produces the following report.

The suggested threshold to maximize profit is based on the numbers you input for:
False Positive Cost: Cost incurred on marketing, sales and other activities on a lead when the positive prediction by the model is wrong i.e. opportunity is lost.
False Negative Cost: Cost of missed opportunity when the negative prediction by the model is wrong.
True Positive Profit: Profit from correctly predicting a positive result i.e. opportunity is won.
True Negative Profit: Profit (or cost saving) from correctly predicting a negative result.
The Score Breakdown shows the list of influencing factors with their relative impact. For example, a relative weight of 47 is used if a prospective buyer is single and 0 if married. You can use these weights to create a scoring formula. The tool provides a worksheet to calculate the score based on the input for each factor and the prediction (win or loss).
If you capture the lead data for influencing factors in Microsoft Dynamics CRM, you can configure a workflow to automatically calculate a lead score based on this data and take appropriate actions such as qualifying a lead, assigning it to an appropriate user or team, sending follow up emails and setting up follow up tasks or phone call activities.

Monday, September 7, 2009

Key Performance Indicators (KPIs)

In business terminology, a Key Performance Indicator (KPI) is a quantifiable measurement for gauging business performance. For example, a retail business may use “Year over year revenue growth” as a KPI to gauge its performance. KPIs are typically shown as part of a dashboard or business scorecard to provide managers and analysts with at-a-glance picture of the state of business.

Technically KPIs may be implemented using any tool or technology. For example, you may be able to create a dashboard using Excel or SQL Server Reporting Services by retrieving the relevant data from a relational database or even entering the data manually into the spreadsheet and creating necessary calculations or formulas based on the data. However, this approach relies on the KPIs being created consistently by different users and developers, which may not be the case.

There are several advantages of using SQL Server Analysis Services to implement KPIs. First, it enables you to define a KPI once and use it in multiple dashboards and reports in multiple contexts. Second, it ensures that the users see the single version of the truth without you having to rely on the users and developers for the correct calculation.

Let us see how it would work using an example. You can create the “Internet Sales Growth” KPI using the following MDX expression in SSAS:

IIF(
SUM(PeriodsToDate([Date].[Fiscal].[Fiscal Year],
ParallelPeriod([Date].[Fiscal].[Fiscal Year], 1, [Date].[Fiscal].CurrentMember)), [Measures].[Internet Sales Amount]
)=0,
"NA",
SUM(PeriodsToDate([Date].[Fiscal].[Fiscal Year], [Date].[Fiscal].CurrentMember),[Measures].[Internet Sales Amount])/
SUM(PeriodsToDate([Date].[Fiscal].[Fiscal Year],
ParallelPeriod([Date].[Fiscal].[Fiscal Year], 1, [Date].[Fiscal].CurrentMember)), [Measures].[Internet Sales Amount]
) - 1
)

The above expression takes advantage of the MDX function ParallelPeriod to get a member from a prior period in the same relative position as the current member (month, quarter, semester, etc.). For example, a parallel period for FY 2004 Q3 is FY 2003 Q3, which will be used to calculate the year over year sales growth.

Once you have created a calculated measure and a KPI based on this calculation, developers and end users can use it in any spreadsheet, report or dashboard in any context. SSAS calculates the KPI automatically as the users slice and dice the data.

For example, users can use this KPI in any of the following:
- report showing year over year sales growth by territory that displays years across the columns and sales territories down the rows
- dashboard showing querterly sales and sales growth over the same quarter in the previous year by product category
- Excel PivotTable showing top 10 customers by sales that also includes sales growth rates for those customers. When the user slices the data further by product, SSAS automatically calculates the sales growth by customer and product.

Monday, September 22, 2008

Create free form reports using cube functions in Excel 2007

Microsoft Analysis Services provides an OLAP (Online Analytical Processing) engine that provides fast access to aggregated business data such as sales, budgets, inventory and costs. Analysis Services publishes data in form of a cube which enables you to filter and group data by predefined categories or dimensions. A cube is often used with Excel PivotTable feature which enables you to browse data interactively in Excel with just a few mouse clicks.

PivotTable report is an excellent tool for structured browsing. On the other hand, it is too inflexible for many common reporting needs. I will describe some of these scenarios later.

The new “Convert to formulas” feature in Excel 2007 addresses this gap. Using this feature, you can convert the cells in a PivotTable to formulas. This feature converts the cells to formulas that use Cube functions. Once you have done that, you can then take full advantage of all Excel features (such as layouts, formats, coloring, annotations, etc.) to produce a report the way you desire. You are no longer limited by the PivotTable’s rigid predefined structure. In addition to converting PivotTable cells to formulas, you can also enter new formulas using Cube functions to create a custom report from scratch or add information to an existing report converted from a PivotTable.

When you convert cells to formulas, these formulas access the same data as the PivotTable report and can be refreshed to see up-to-date results. However, with the possible exception of report filters, you no longer have access to the interactive features of a PivotTable report, such as filtering, sorting, or expanding and collapsing levels.

Common scenarios for converting PivotTable reports to formulas

The following are a few examples of what you can do after you convert PivotTable cells to worksheet formulas to customize the layout of the converted cells.

Rearrange and delete cells
Example: There are two divisions in your company: Bicycles and Accessories. For the sales report for the Bicycles division managers, you want to include sales data for both divisions but the cost information only for the Bicycles division. You also want to rearrange and group certain products in the report and add subtotals for the group. You want to format some cells by changing the cell color and making them bold. In this case, you can create the PivotTable, convert it to worksheet formulas, rearrange cells to a design layout you desire, delete the cells that are not necessary (cost information for Accessories division) and format the cells (bold, color, conditional formatting, etc.) to suit your preference.

Insert rows and columns
Example: For the sales report, you want to insert a row to display a subtotal for two products. You also want to add three columns to show the Budget data, Budget Variance and Year Over Year Percentage change in sales for each product and product group.

Use multiple data sources
Example: You want to include the budget data stored in Excel spreadsheets or a relational database on your sales report for variance analysis that shows the difference between budgeted and actual sales.

Use cell references to vary user input
Example: When the user changes a cell value from “MTD” to “YTD”, you want to refresh the report with the Year to Date information and vice versa. You can reference the input cell in your worksheet formulas to achieve this result.

Create a nonuniform row or column layout (also called asymmetric reporting)
Example: You need to create a report that contains a 2008 column called Actual Sales, a 2009 column called Forecast, but you don’t want any other columns. You can create a report that contains just those columns unlike a PivotTable report, which requires symmetric reporting.

Create your own Cube formulas and MDX expressions
As mentioned earlier, you can create a completely new report from scratch by using the combination of cube functions and MDX expressions. For example, you may enter a cube formula to retrieve sales amount for the Western region for the salesperson Smith for 2007 Q4 by product or product category. You may also enhance your converted PivotTable report by entering new formulas using Cube functions.

Steps to create a free form report
Next, let us see how all this works using an example. In this example, we will create the following custom report.

Note: Sorry about the missing screenshot. This is an old post, and I am unable to find this image. However, I have posted an update here with a similar report.










Follow these steps to create the above custom report.

1. Create a PivotTable Report as shown in the screen shot below. I used the Adventure Works Sales cube for the purpose of this example. I recommend making a copy of the workbook before converting to formulas, in case you need to refer to the original PivotTable or reuse it to create another free form report later. You would want to prepare the PivotTable report as close to the layout you want as possible. This will minimize the effort required in making changes to the report after you have converted it to formulas. You can use filtering, sorting and layout features of the PivotTable to achieve this.

2. Click PivotTable. On the Options tab, in the Tools group, click OLAP tools, and then click Convert to Formulas. If you want to convert the entire PivotTable to formulas, select Convert Report Filters checkbox. Clear this checkbox to convert only the PivotTable row labels, column labels, and values area, but keep the Report Filters. In this example, we do not have the Report Filters for our report. Therefore, clear the checkbox and click Convert.You will notice that Excel 2007 has converted the PivotTable cells to use the cube functions CUBEMEMBER and CUBEVALUE. I will discuss these and the other CUBE functions in the following section.
For cells that are converted, cell formatting is preserved, but PivotTable styles are removed because these styles are applicable to PivotTables only.

3. Delete unwanted columns and rows. In our case, we will delete the following columns: 2001, 2002, Grand Total.

4. Switch 2003 and 2004 columns as desired for our custom report.

5. Insert the following 3 columns: Budget, Variance %, YOY Change %. The Budget column was populated by copying and pasting values from a separate Budget spreadsheet. Variance % column is calculated as: (Actual – Budget) / Budget. YOY Change % column is calculated as: (Current Year Actual – Previous Year Actual) / Previous Year Actual.

6. Format the report and cells as desired.

That’s all! We were able to create a custom report with a few simple steps.

Explanation of CUBE functions

In this section, I will briefly explain the CUBE functions available in Excel 2007 using examples.

The CUBEMEMBER function returns a member or tuple from the cube. A tuple uniquely identifies a cell, based on a combination of attribute members that consist of an attribute from one or more attribute hierarchies in the cube. For example, a tuple may represent members from two dimensions (Geography and Product) or even one or more dimensions and measure. Here are a couple of examples showing the use of CUBEMEMBER function.
A1=CUBEMEMBER("Adventure Works","[Ship Date].[Calendar].[Calendar Year].&[2002]") retrieves the cube member representing calendar year 2002 of Ship Date dimension.
A2=CUBEMEMBER("Adventure Works","[Measures].[Reseller Sales Amount]") retrieves the cube member representing Reseller Sales Amount measure of the cube.
The above two cells (A1 and A2) can be used as references to retrieve the Reseller Sales Amount for the calendar year 2002 as shown below.

The CUBEVALUE function returns an aggregated value from the cube for a member or tuple from the cube. For example, the following function retrieves a tuple representing Reseller Sales Amount for calendar year 2002.
A3=CUBEVALUE("Adventure Works",A1,A2)
A member is a value of a dimension attribute (such as customer names, product names, month names, etc.).
A tuple uniquely identifies a cell, based on a combination of attribute members that consist of an attribute from every attribute hierarchy in the cube. When defining a tuple in an MDX query or expression, you do not need to explicitly include the attribute member from every attribute hierarchy. If a member from an attribute hierarchy is not explicitly included in a query or an expression, the default member for that attribute hierarchy is the attribute member implicitly included in the tuple. Unless otherwise explicitly defined in a cube, the default member for every attribute hierarchy is the (All) member, if an (All) member exists. If an (All) member does not exist within an attribute hierarchy, the default member is a member of the attribute hierarchy's top level. The default measure is the first measure specified in the cube, unless a default measure is explicitly defined. For more information, see Defining a Default Member and DefaultMember (MDX).

The following are a few more Cube functions available in Excel 2007.

CUBEKPIMEMBER
Returns a key performance indicator (KPI) property and displays the KPI name in the cell. A KPI is a quantifiable measurement, such as monthly gross profit or quarterly employee turnover, that is used to monitor an organization's performance.
CUBEMEMBERPROPERTY
Returns the value of a member property from the cube. Use to validate that a member name exists within the cube and to return the specified property for this member.
CUBERANKEDMEMBER
Returns the nth, or ranked, member in a set. Use to return one or more elements in a set, such as the top sales performer or the top 10 students.
CUBESET
Defines a calculated set of members or tuples by sending a set expression to the cube on the server, which creates the set, and then returns that set to Microsoft Office Excel.
CUBESETCOUNT
Returns the number of items in a set.

Conclusion

In this article, I have described how you can create free form reports in any desirable format using Excel 2007 and Cube functions.

Related:

Creating Free Form Reports using Cube functions in Excel - Follow Up