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

Wednesday, December 31, 2014

Excel Timeline Error: We can’t create a Timeline for this report because it doesn't have a field formatted as Date.

You might get the error below when trying to insert a Timeline filter in an Excel Pivot table that is built off of an SSAS (SQL Server Analysis Services) Cube. Timeline filter is a new feature of Excel 2013 that can be used as a ‘visual filter’ to filter data in pivot tables.

We can’t create a Timeline for this report because it doesn't have a field formatted as Date.


It appears that the Timeline filter requires the MemberValue property of the key column in the date dimension to be a date field (date or datetime both works). So to resolve this issue, just point the ValueColumn property of the key column of your date dimension to a date field as shown in the screen shot below.


Also, please note that Timeline filter also requires the Type property of the date dimension to be set to Time. Hope this is helpful.

Saturday, January 26, 2013

SSAS - Duplicate attribute key found when processing

I have been seeing this error time and time again when processing cubes in Analysis Services and thought it would be a good idea to blog about it. When processing Analysis Services cubes, you might see the following error:

Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'tblCustomers', Column: ‘Customer_Name’, Value: ''. The attribute is ‘Customer Name'.

As you can see, Analysis Services is complaining that there is a duplicate “blank” value in the column Customer_Name. How can there be a duplicate blank value as Analysis Services runs  a SELECT DISTINCT query on the relational table to retrieve column values when processing? Well, a few other things happen “under the hood” when Analysis Services is processing. Let’s consider a scenario where we have the following values in our Customer table:

Customer_Id
Customer_Name
1
ABC
2
XYZ
3
NULL
4

When Analysis Services processes a dimension, it will execute a SELECT DISTINCT query to retrieve a list of all the distinct values for each attribute; in our example, it will retrieve 4 DISTINCT values – ABC, XYZ, NULL, ‘’ (the last one being empty string). Now the tricky thing is that Analysis Services will then convert the NULL value to an empty string and so the list of values after conversion would be - ABC, XYZ, ‘’, ‘’ (the last two being empty strings). Obviously, the distinct list of values for Customer Name aren’t distinct anymore as there are two empty strings. In other words, the NULL value is being converted to an empty string and we already have an empty string in the distinct list. This is when Analysis Services fails to process the dimension complaining that there is a duplicate value “”(empty string). This behavior is actually controlled by an attribute property called “NullProcessing” which is set to Automatic by default. Setting it to automatic means that Analysis Services will convert NULL values to “empty string” if the attribute is of type text and to 0 if the attribute is of type numeric.

Let me give you another example as shown in the table below, and this time, let’s consider a numeric attribute.

Customer_Id
Number_of_Bikes
1
4
2
10
3
NULL
4
0

In this case, the error would be - Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'tblCustomers', Column: ‘Number_of_Bikes’, Value: '0'. The attribute is ‘Number of Bikes’.

Notice that now, Analysis Services is complaining that there is a duplicate zero value. When Analysis Services processes this dimension, it will come up with the following DISTINCT list of values - 4, 10, NULL, 0. It will then convert NULL to 0(zero) since the attribute is numeric. So the list of DISTINCT values after converting NULL to 0 would be - 4, 10, 0, 0. As you can see, the list is not distinct anymore and so Analysis Services would fail to process the dimension.

One of the easiest ways to resolve this is to convert NULL values in your data source to blank or zero if the attribute is text or numeric respectively. For example, you can use ISNULL(Customer_Name, ‘’) in your data source view to convert NULL value to an empty string(if the attribute is text) and use ISNULL(Number_of_Bikes, 0) to convert NULL value to 0( if the attribute is numeric).

Just a side note that you’ll see some other errors when this issue occurs and in most of the cases, these errors would be generic and less than helpful. I have seen the following errors when this issue occurs:


“Errors in the OLAP storage engine: An error occurred while the dimension, with the ID of 'Customer', Name of 'Customer' was being processed”

"OLE DB error: OLE DB or ODBC error: Operation canceled; HY008."

While the first error is generic, the second one could be due to various reasons including the one we discussed. Please see this post for the other possible reasons for the second error – Analysis Services Cube processing fails with error "OLE DB error: OLE DB or ODBC error: Operation canceled; HY008.

Hope this helps!

Saturday, September 22, 2012

OLE DB or ODBC error:Login failed for user NT Service\MSSQLServerOLAPService


You might get the error: OLE DB or ODBC error: Login failed for user 'NT Service\MSSQLServerOLAPService' when processing a cube/dimension. Here is what causes this error and how you can resolve the problem:

SQL Server Analysis Services will use the service account(by default) to pull data from the data source (the database server that hosts the data). If your Analysis Services instance is running under the account 'NT Service\MSSQLServerOLAPService', then this account will be used(by default) to read data from the databases and if the account doesn't have read access, you will get the above error. To resolve this, just grant the account read access to the relational database(s) you are trying to pull data from.

Also, please note that it is recommended to setup the data sources to use a domain account and to setup Analysis Services to run under a domain account. More details on data source impersonation options can be found here - http://technet.microsoft.com/en-us/library/ms187597.aspx


Sunday, April 8, 2012

Start/Stop SQL Server from command line


You can using the following script to start/stop SQL Server services using command line:

SQL Server Database Engine(both SQL Server service and SQL Server Agent):
NET STOP SQLSERVERAGENT
NET STOP MSSQLSERVER
NET START MSSQLSERVER
NET START SQLSERVERAGENT

SQL Server Reporting Services:
NET STOP ReportServer
NET START ReportServer

SQL Server Analysis Services:
NET STOP MSSQLServerOLAPService
NET START MSSQLServerOLAPService

Tuesday, March 27, 2012

Analysis Services error: The size specified for a binding was too small

Analysis Services error: Errors in the back-end database access module. The size specified for a binding was too small, resulting in one or more column values being truncated.

This error occurs when the size(number of characters) of an attribute exceeds the DataSize defined in the attribute properties of the dimension. By default, Analysis Services sets the size of an attribute based on the size defined in the relational database.

For example, let’s say you have a field called CustomerID which is defined as VARCHAR(4) in the database. If you use this field as an attribute in a dimension, Analysis Services will set the DataSize property to 4. You can see this property by expanding the NameColumn and KeyColumns property of the attribute.

Now, if you replace the dimension in Analysis Services with a named query and edit the  CustomerID field with something like CASE WHEN CustomerID IS NULL THEN ‘Not Defined’ ELSE CustomerID END AS CustomerID, the cube fail to process because Analysis Services has already set the data size for CustomerID to 4 but we just violated this by using the value ‘Not Defined’ which is of length 12.

To resolve this issue, all we need to do is increase the value of the property called DataSize for the attribute under both NameColumn and KeyColumns.

Hope this helps.

Friday, March 23, 2012

Integration Services and Analysis Services missing in Management Studio


If you don’t see Integration Services and Analysis Services  in SQL Server Management Studio in “connecting to server” dialog box, there could be one of the two reasons listed below: 

1. You are using SLQ Server  Management Studio Express(SSMSE). If so, please note that you can’t use SSMSE to manage SQL Server Analysis Services, Integration Services, Notification Services, Reporting Services, SQL Server Agent, or SQL Server 2005 Mobile Edition.
2. You only have “Management Tools - Basic” installed. To be able to connect to other services(Integration Services, Analysis Services  etc), you’ll need to have “Management Tools - Complete”. Just run the installation file again and select the option shown in the screen shot below to resolve this.


Sunday, October 2, 2011

SQL Server Analysis Services Tutorials

Articles:
SQL Server Analysis Services 2008 R2 Tutorial - http://technet.microsoft.com/en-us/library/ms170208.aspx
SQL Server Analysis Services 2005 Tutorial - http://msdn.microsoft.com/en-us/library/ms170208(v=sql.90).aspx

Videos:
The following website has an excellent list of SQL Server Analysis Services videos by Craig Utley - http://www.learnmicrosoftbi.com/Videos/tabid/75/Default.aspx. You can download all of them(free), just need to register.

Hands-on Labs:
MSDN Virtual Lab: Building Your First Cube with SQL Server 2008 R2 Analysis Services - https://cmg.vlabcenter.com/default.aspx?moduleid=b9b8dd3e-81c1-42fe-9434-446bedb52aff
MSDN Virtual Lab: Building Your First Queries and Calculations with SQL Server 2008 R2 Analysis Services MDX - https://cmg.vlabcenter.com/default.aspx?moduleid=9e785ad4-b926-4d77-b248-006697aec684

Thursday, September 22, 2011

Creating SSRS Report against Analysis Services Cube


Here is a step by step procedure(screenshots) on how to create a SQL Server Reporting Services 2008 Report on top of an Analysis Services Cube.













Managing Analysis Services Deployment


Once you have finished the development of Analysis Services project, there are several methods available for deploying analysis services objects from one server to other server. In this series, we will discuss the most commonly used deployment methods one by one. The entire series covers deployment using:
BIDS
Analysis services Deployment Wizard
Backup and Restore
The Synchronize Database Wizard

Wednesday, September 21, 2011

Storage Modes in Analysis Services


Storage mode in SQL Server Analysis Services(SSAS) lets you decide where you want to physically store the data(both aggregations and cube data). There are three types of storage modes:

MOLAP (Multidimensional OLAP) – This mode stores both cube data and aggregations in Analysis Services server. This is the the default storage mode in SSAS and is the fastest of the three modes in terms of query performance. However, this mode requires more disk space(to duplicate the detail-level data) and will obviously increase the cube’s processing time. Also, in this mode, once the cube is processed, the relational data source is not accessed when users query the cube and so, any changes made to the relational data source after the processing of the cube will not be reflected in the cube until the cube in processed again.

ROLAP (Relational OLAP) – Unlike MOLAP, in this mode, both cube data and aggregations are stored in the relational data source. To store aggregations, Analysis Services will create additional tables in the relational data source. When users run MDX queries, Analysis Services will generate SQL statements against the relational data source to retrieve the data requested. Since the data has to be brought over from the relational data source(which in most cases resides on a different server), this mode is the slowest of the three modes in terms of query performance but it supports real-time and is better than MOLAP in terms of storage and processing.

HOLAP (Hybrid OLAP) – This mode is a hybrid between MOLAP and ROLAP and offers the best of the two modes. This mode stores cube data in the relational data source and aggregations & indexes in Analysis Services server. You need to be careful with HOLAP because since the aggregations are on the Analysis Services server, you will get wrong results when the leaf level data(in the relational store) is updated but the cube is not processed. So it is critically important to keep aggregations and the leaf level data in sync.

The following system error occurred: The file exists. . (Microsoft SQL Server 2005 Analysis Services)


You might face this error when restoring a SQL Server Analysis Services cube from a backup.


The following system error occurred: The file exists. . (Microsoft SQL Server 2005 Analysis Services)
The reason the restore process failed is probably because you are trying to restore from a higher version of SSAS to a lower version(example, from SSAS 2012 to SSAS 2008 etc.), which is not supported. Please be sure that you are not going backwards(in version). This holds true for Relational database backups as well.