1. If you are facing this error, Try first to Full Process all your Dimensions and then reprocess your cube.
2. When
the Key value is present in the fact table but not present in the Dimension
table (The keys on which Dim and Fact tables are linked See key relation in Dimension Usage tab.)
Dim Table
|
|
Fact Table
|
ProductKey
|
Product
Name
|
Product
Status
|
|
ProductKey
|
Sale
Price
|
Qty.
|
-1
|
Unknown
|
unknown
|
|
1
|
200
|
20
|
1
|
Shirt
|
A
|
|
2
|
300
|
15
|
2
|
cap
|
A
|
|
3
|
20
|
100
|
3
|
Pen
|
A
|
|
4
|
20
|
100
|
|
|
|
|
5
|
10
|
15
|
Workaround:
- If you face this issue
select distinct key values from Dim table and Select distinct Key values
from fact table , compare and check which key value that is present in
Fact table and not present in Dim table . Investigate and plan your next
course of action.
- If above point is true in
your scenarios, you can insert missing Key value in Dim table that is
present in fact table but not present in Dim table.
- You can restrict Fact table
records for the key value that is not present in the dim table.
(This is just an example you have to plan your
course of action what to do according your requirement. But I would like to
suggest you investigate in your fact table and dim table populating logic why
this key value is present in fact table and not present in Dim table.)
3. When there is a null value
present in your fact table key column value.
Some times while populating the
fact table from different sources, we use many joins (left, right etc). Due to
lack of data in any source tables, Key value can be null in fact table. Then
you can face this issue.
Dim Table
|
|
Fact Table
|
ProductKey
|
Product
Name
|
Product
Status
|
|
ProductKey
|
Sale
Price
|
Qty.
|
-1
|
Unknown
|
unknown
|
|
1
|
200
|
20
|
1
|
Shirt
|
A
|
|
2
|
300
|
15
|
2
|
cap
|
A
|
|
3
|
20
|
100
|
3
|
Pen
|
A
|
|
null |
10 |
15 |
|
|
|
|
|
|
|
See above fact table, there is
null value in Key column and there is no matching Key value is in Dim
table .In this Case, you might experience error “Errors
in OLAP Storage Engine The attribute key cannot be found when processing.”
Workaround:
While designing the dim table
you should insert one record with -1 for key value.
Let say you have product table for dimension with
columns [Product ID], [Product Name],[Product status] you should populate
it as
Product ID
|
Product Name
|
Product Status
|
-1
|
unknown
|
unknown
|
While populating the dim table your SQL should be
like below
SELECT
-1 as ProductID,
‘unknown’ As ProductName,
‘unknown’ AS ProductStatus
Union ALL
Select
ProductID,
ProductName,
ProductStatus
From your <Source Dimension tables>
Use following logic to populate Fact Table key
columns
Select ISNULL( ProductID ,-1) AS
ProductID
This practice you have to follow
for other key column values also. Doing so, when due to any reason if key value
column have null from source tables then it will convert to -1 key column value
in fact table .Now you have -1 as key value in both Fact table and Dim table.
In this case there will be no chance of key mismatches and all the record will
be aggregated under unknown or -1 and your cube will not fail during processing.
Now see you have populated -1
for the null key value column of fact table. It will match with -1 key value of
Dim table.
Dim Table
|
|
Fact
Table
|
ProductKey
|
Product Name
|
Product Status
|
|
ProductKey
|
Sale Price
|
Qty.
|
-1
|
Unknown
|
Unknown
|
|
1
|
200
|
20
|
1
|
Shirt
|
A
|
|
2
|
300
|
15
|
2
|
cap
|
A
|
|
3
|
20
|
100
|
3
|
Pen
|
A
|
|
-1
|
10
|
15
|
4. Sometimes
keys are present in the fact and Dim table but still you get this error.
Workaround:
·
In
this case it might be the reason that you have used Named Query or View to
build your dimension in cube where you have made some restriction/Filter etc.
·
If
your Dim table and fact table key values are of Varchar/String data type then
there may be chance of blank spaces. Then you should take care of blank spaces
using Ltrim/RTrim etc