Showing posts with label attribute. Show all posts
Showing posts with label attribute. Show all posts

Wednesday, March 21, 2012

Errors while browsing the cube - "#Value"

While browsing the cube, I'm getting a "#Value" error, which I believe is due to the non existence of certain attribute members.

For example, working on Adventure Works database. Assuming there is no Product Category = 5 in the SSAS database but we want to add this category into the calculation for future purposes, so the calculation would be as follows

(Measures.[Internet Sales Amount], [Product].[Category].&[5])

This calculation gives me a "#Value" error while browsing, to handle this kind of situation, I added an exception handling, check whether the member exist, if not return 0.

IIF(

ISEMPTY(EXISTS([Product].[Category].[Category].MEMBERS, [Product].[Category].&[5]).ITEM(0)),

0,

Measures.[Internet Sales Amount], [Product].[Category].&[5]

)

This seems to work fine in the SQL Managemen Studio, but when added to the Cube in the Calculations and processes, still I get the same "#Value" error.

Is the apporach to handle this is right? Is there a different way to handle this?

-

Vivek

Doing the whole "IIF( ISEMPTY( EXISTS(...)))" is going to wreck your performance. I'm surprised that it appears to work in SSMS as the EXISTS function will attempt to resolve both the sets in order to evaluate them and should throw an exception trying to resolve [Product[.[Category].&[5] and IsEmpty is not checking if the set is empty, but rather it will be doing a value comparison against the default measure which could lead to misleading results.

There are better ways to code a check like this, but they are still not a good idea. If you know you are going to have a Category 5, add that row to the dimension now and re-process the dimension, even though you don't yet have any facts for it. This way this script will be able to resolve the member reference and everything will work.

Adding references in the script to non-existant members and trying to trap errors is generally a bad thing.

NOTE: in SSMS you can hover over or double click on the #Value to see the text of the error message.

|||

Thanks for the reply.

I guess you are right, I further did a search on this and go the same inputs.

Books Online suggested to use "IS" instead of "ISEMPTY()" to check for emptiness of dimension/attribute members. Even this works in SSMS (MDX query) and when ported to BIDS and browse fails.

You did say there are ways to handle this kind of exception, can you share them? I know it is performance intensive, but I have to catch such kind of exception.

-

Vivek

|||

Just to be entirely clear - you ONLY ever need this sort of check if you are taking user input for something like a parameter in SSRS or some other reporting engine. You should NEVER use the following type of code in your MDX Script.

The pattern in something like an SSRS report would look like the following, passing in the unique name as a string and using the StrToMember() function and testing with the IS operator.

eg.

IIF( StrToMember( @.parameter ) IS NULL, ...

I know I am repeating myself, but I need to make sure this is clear - if you know that you are going to need a product category 5, then create it in the dimension member now. Never put references in your MDX script to members that do not yet exist and then try to wrap these references with code to handle the errors.

If you have a calc that works in SSMS, but not in BIDS, it will be because of the way the browser control in BIDS is structuring the query. Start up a profiler session and capture the queries that BIDS generates and test them in SSMS. There will probably be multiple commands fired off as BIDS quite often uses things like session scoped sets in it's queries.

|||

Darren,

Thanks. Surely will not use this in BIDS, as it clearly doesn't work.

--

Vivek

Errors while browsing the cube - "#Value"

While browsing the cube, I'm getting a "#Value" error, which I believe is due to the non existence of certain attribute members.

For example, working on Adventure Works database. Assuming there is no Product Category = 5 in the SSAS database but we want to add this category into the calculation for future purposes, so the calculation would be as follows

(Measures.[Internet Sales Amount], [Product].[Category].&[5])

This calculation gives me a "#Value" error while browsing, to handle this kind of situation, I added an exception handling, check whether the member exist, if not return 0.

IIF(

ISEMPTY(EXISTS([Product].[Category].[Category].MEMBERS, [Product].[Category].&[5]).ITEM(0)),

0,

Measures.[Internet Sales Amount], [Product].[Category].&[5]

)

This seems to work fine in the SQL Managemen Studio, but when added to the Cube in the Calculations and processes, still I get the same "#Value" error.

Is the apporach to handle this is right? Is there a different way to handle this?

-

Vivek

Doing the whole "IIF( ISEMPTY( EXISTS(...)))" is going to wreck your performance. I'm surprised that it appears to work in SSMS as the EXISTS function will attempt to resolve both the sets in order to evaluate them and should throw an exception trying to resolve [Product[.[Category].&[5] and IsEmpty is not checking if the set is empty, but rather it will be doing a value comparison against the default measure which could lead to misleading results.

There are better ways to code a check like this, but they are still not a good idea. If you know you are going to have a Category 5, add that row to the dimension now and re-process the dimension, even though you don't yet have any facts for it. This way this script will be able to resolve the member reference and everything will work.

Adding references in the script to non-existant members and trying to trap errors is generally a bad thing.

NOTE: in SSMS you can hover over or double click on the #Value to see the text of the error message.

|||

Thanks for the reply.

I guess you are right, I further did a search on this and go the same inputs.

Books Online suggested to use "IS" instead of "ISEMPTY()" to check for emptiness of dimension/attribute members. Even this works in SSMS (MDX query) and when ported to BIDS and browse fails.

You did say there are ways to handle this kind of exception, can you share them? I know it is performance intensive, but I have to catch such kind of exception.

-

Vivek

|||

Just to be entirely clear - you ONLY ever need this sort of check if you are taking user input for something like a parameter in SSRS or some other reporting engine. You should NEVER use the following type of code in your MDX Script.

The pattern in something like an SSRS report would look like the following, passing in the unique name as a string and using the StrToMember() function and testing with the IS operator.

eg.

IIF( StrToMember( @.parameter ) IS NULL, ...

I know I am repeating myself, but I need to make sure this is clear - if you know that you are going to need a product category 5, then create it in the dimension member now. Never put references in your MDX script to members that do not yet exist and then try to wrap these references with code to handle the errors.

If you have a calc that works in SSMS, but not in BIDS, it will be because of the way the browser control in BIDS is structuring the query. Start up a profiler session and capture the queries that BIDS generates and test them in SSMS. There will probably be multiple commands fired off as BIDS quite often uses things like session scoped sets in it's queries.

|||

Darren,

Thanks. Surely will not use this in BIDS, as it clearly doesn't work.

--

Vivek

sql

Monday, March 19, 2012

Errors in the OLAP storage engine: The attribute key cannot be found

I'm somewhat new to using SQL server analaysis services so bear with me on this post.

I am getting the following error when trying ot process a simple cube I built:

Errors in the OLAP storage engine: The attribute key cannot be found: Table: dbo_vwInvoice, Column: Invoice_x0020_Date, Value: 3/7/2004 10:00:00 AM.

This cube use an Invoice table as the fact table and then a "geography" table as a dimensions table. I am using the server built time dimension which seems to be the problem. It seems to not like the "Invoice Date" field which is a datetime field. This appears to happen on imported data from a legacy application where that application didn't store time so we defaulted the time to 10:00 AM. My guess is that the Invoice Date field has to be unique? If that is the case, any idea on how to get aroudn that?

Thanks for your time,

Marc

Hi,

The error means that the '3/7/2004 10:00:00 AM' value from the 'dbo_vwInvoice' fact table cannot be found in the time dimension table. You mentioned that the time dimension is the server generated one. The server time dimensions only go down to the day level (not hour, minute and second), thus the value will indeed not be found.

If you do not need to do analysis on the hour/minute/second level (in other words, if you do not use the time part of the 'Invoice Date' from from the 'dbo_vwInvoice' fact table), then you can do this:

- create a calculated column (in the DataSourceView, you don't need to alter the actual relational table) in the 'dbo_vwInvoice' fact table to only keep the date part of the 'Invoice Date' column

- then join the fact table (in the 'Dimension Usage' tab of the cube editor) with the time dimension table by that calculated column

Adrian Dumitrascu

|||

You know, I was kind of thinking that but I couldn't find any documentation stating that. Thanks for the response. I would have thought it would inheritly figure out that the field is a datetime field and to just extract the date portion. Easy enough to fix though.

Thanks again,

Marc

|||

Well I spoke too soon. I'm still getting the error. I did a convert(varchar(10),invoice date,101) as the calculated field and still came up with this errror:

Errors in the OLAP storage engine: The attribute key cannot be found: Table: dbo_vwInvoice, Column: InvoiceDateOnly, Value: 3/29/1998. Errors in the OLAP storage engine: The record was skipped because the attribute key was not found. Attribute: Date of Dimension: TimeDimension from Database: WinSTIS Analysis Services Project, Cube: Winstis, Measure Group: Vw Invoice, Partition: Vw Invoice, Record: 11.

Any ideas?

Thanks,

Marc

|||

Sorry for the confusion. I figured it out. It was because I didn't have a large enough date range on the time dimension...

Marc

Sunday, March 11, 2012

Errors in OLAP storage Engine: The attribute Key cannot be found: URGENT

Hi,

Okay, I am stuck here with this error and other related errors. before anything I will describe the scenario. Please do tell me What is wrong, How it happened and how to correct it.

Initially I had 3 relational tables in SQL server.
1. Dim_A (col1a, col2a, col3a)
2. Dim_B (col1b, col2b)
3. Fact_data (col1a,Col1b)

There are no Primary keys, foreign keys and relationships defined in the SQL relational database between these tables.

I created a OLAP database by:
1. creating the datasource
2. creating the datasource view and setting the logical primary keys and relationships as follows:
a. Fact_data.col1a references -> Dim_A.col1a
b. Fact_data.col1b references -> Dim_B.col1b
3. Next, I created a Cube, without automatically creating attributes or hierarchies (no auto build)
4. A Measure Group was automatically created, with a measure called Fact_data count (which i think is the count of the number of rows and was equal to 145). I checked the relational table "Fact_data" to find that the fact table had indeed 145 rows.
5. Next I built the project with not errors, then deployed and processed it.
6. I had no errors and I was able to browse the cube in the SQL BI studio.

After all this, I had created a asp.net page to issue the "Process" command to the complete OLAP database. (I had used the Process Script XMLA from the BI studio). This was also running perfectly.

Now the problem, suddeny next day when i ran the Process from my Asp.Net page, it gave me errors saying that there are Errors in the OLAP Storage engine. The attribute Key cannot be found, with the Table name, Column name and the value. It also gave other errors saying: The record was skipped because the attribute key was not found. it gave the info of the attribure, Dimension, database, cube, measure group and Partition.

I checked the SQL relational tables to find a change in the "Fact_data" table structure. Here is the changed structure of the Fact_data table:

Fact_data (col1a,Col1b,colNewC)

A new column "colNewC" was added to the table. Actually this was a new table with the same name as the old one with a new column. the old table was renamed and probably changed by some other person.
so i thought that the change in structure was the problem.

I created a new Analysis services project in the SQL BI studio, repeated the steps stated above to create a OLAP database. Then I built the project with no erros.
Next while trying to deploy and process the project. It is giving me the same errors. Attribute Key not found. I am neither able to deploy only or deploy and process.

Next I changed the error handling settings and set it to convert the not found keys to unknown. now it gave me esactly 145 errors, with the No attribute keys found. but with deployment and processing complete.
Now trying to browse the cube gives no records at all.

I analyzed the tables and its records, I felt that this was because the records present in the Fact_data table had no matching records in the Dim_A table. or specifically there were no matching "col1a" columns between them. thus all the 145 rows of the Fact_data table were shown as errors.


My question is:
1. So is this only a data in-consistency issue?
2. When somebody changed the Fact_data table structure, they also changed the data which had no matching columns with the dim_A table? is this correct? and hence the errors.
3. The only possible way to correct this is to populate the correct records, is this right?

Sorry for the lengthy post, but i thought it would describe the scenario better. Please do give a detailed answer for this and also how to correct it.

Thanks and regards

Try defining primary key-foreign key relationships in your SQL database.

This should help you to deal with referential integrity errors you are seeing.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||

When running the XMLA Script run the default refresh of the dimesions first then process the cube for a full refresh..

The Error means that the Fact tables foriegn key doest match with the Primary key of the Dim Table AKA the lookup table (DIM) doest have a value to match with the DIM Table.Hope this Explains.

If there are lotsa invalidated data in the fact table change the Error procession configuration to notify and continue.

|||

I got exactly the same error message as your post here when I tried to process and deploy the cube in BIDS, did the answer posted here help you solve the problem above?

I want to knwo if that helped solve the problem then I may try this solution.

With best regards,

Yours sincerely,

Errors in OLAP storage Engine: The attribute Key cannot be found: URGENT

Hi,

Okay, I am stuck here with this error and other related errors. before anything I will describe the scenario. Please do tell me What is wrong, How it happened and how to correct it.

Initially I had 3 relational tables in SQL server.
1. Dim_A (col1a, col2a, col3a)
2. Dim_B (col1b, col2b)
3. Fact_data (col1a,Col1b)

There are no Primary keys, foreign keys and relationships defined in the SQL relational database between these tables.

I created a OLAP database by:
1. creating the datasource
2. creating the datasource view and setting the logical primary keys and relationships as follows:
a. Fact_data.col1a references -> Dim_A.col1a
b. Fact_data.col1b references -> Dim_B.col1b
3. Next, I created a Cube, without automatically creating attributes or hierarchies (no auto build)
4. A Measure Group was automatically created, with a measure called Fact_data count (which i think is the count of the number of rows and was equal to 145). I checked the relational table "Fact_data" to find that the fact table had indeed 145 rows.
5. Next I built the project with not errors, then deployed and processed it.
6. I had no errors and I was able to browse the cube in the SQL BI studio.

After all this, I had created a asp.net page to issue the "Process" command to the complete OLAP database. (I had used the Process Script XMLA from the BI studio). This was also running perfectly.

Now the problem, suddeny next day when i ran the Process from my Asp.Net page, it gave me errors saying that there are Errors in the OLAP Storage engine. The attribute Key cannot be found, with the Table name, Column name and the value. It also gave other errors saying: The record was skipped because the attribute key was not found. it gave the info of the attribure, Dimension, database, cube, measure group and Partition.

I checked the SQL relational tables to find a change in the "Fact_data" table structure. Here is the changed structure of the Fact_data table:

Fact_data (col1a,Col1b,colNewC)

A new column "colNewC" was added to the table. Actually this was a new table with the same name as the old one with a new column. the old table was renamed and probably changed by some other person.
so i thought that the change in structure was the problem.

I created a new Analysis services project in the SQL BI studio, repeated the steps stated above to create a OLAP database. Then I built the project with no erros.
Next while trying to deploy and process the project. It is giving me the same errors. Attribute Key not found. I am neither able to deploy only or deploy and process.

Next I changed the error handling settings and set it to convert the not found keys to unknown. now it gave me esactly 145 errors, with the No attribute keys found. but with deployment and processing complete.
Now trying to browse the cube gives no records at all.

I analyzed the tables and its records, I felt that this was because the records present in the Fact_data table had no matching records in the Dim_A table. or specifically there were no matching "col1a" columns between them. thus all the 145 rows of the Fact_data table were shown as errors.


My question is:
1. So is this only a data in-consistency issue?
2. When somebody changed the Fact_data table structure, they also changed the data which had no matching columns with the dim_A table? is this correct? and hence the errors.
3. The only possible way to correct this is to populate the correct records, is this right?

Sorry for the lengthy post, but i thought it would describe the scenario better. Please do give a detailed answer for this and also how to correct it.

Thanks and regards

Try defining primary key-foreign key relationships in your SQL database.

This should help you to deal with referential integrity errors you are seeing.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||

When running the XMLA Script run the default refresh of the dimesions first then process the cube for a full refresh..

The Error means that the Fact tables foriegn key doest match with the Primary key of the Dim Table AKA the lookup table (DIM) doest have a value to match with the DIM Table.Hope this Explains.

If there are lotsa invalidated data in the fact table change the Error procession configuration to notify and continue.

|||

I got exactly the same error message as your post here when I tried to process and deploy the cube in BIDS, did the answer posted here help you solve the problem above?

I want to knwo if that helped solve the problem then I may try this solution.

With best regards,

Yours sincerely,

Sunday, February 26, 2012

Error1Dimension '...' : The following attribute(s) form loop(s):

Hello!

I have an error on a dimension, saying
"Error 1 Dimension 'Car Park Type' : The following attribute(s) form loop(s): [Car Park Type], [Car Park Key]. 0 0 "
but I do not have much idea of what it could mean.

This dimension is based on this request :
SELECT 'Inside' AS CarParkType, InsideCount AS CarParkCount, BuildingKey, OfferKey, TransactionKey, CarParkKey
FROM dimCarPark
WHERE (InsideCount > 0)
UNION
SELECT 'Outside' AS CarParkType, OutsideCount AS CarParkCount, BuildingKey, OfferKey, TransactionKey, CarParkKey + 100000 AS Expr1
FROM dimCarPark AS dimCarPark_3
WHERE (OutsideCount > 0)
UNION
SELECT 'Proximity' AS CarParkType, ProximityCount AS CarParkCount, BuildingKey, OfferKey, TransactionKey, CarParkKey + 200000 AS Expr1
FROM dimCarPark AS dimCarPark_2
WHERE (ProximityCount > 0)
UNION
SELECT 'Double' AS CarParkType, DoubleCount AS CarParkCount, BuildingKey, OfferKey, TransactionKey, CarParkKey + 300000 AS Expr1
FROM dimCarPark AS dimCarPark_1
WHERE (DoubleCount > 0)

Does anyone have any idea?

Thanks anyway.I have found. There was an error in the attributes of the dimension.

Bye!