Expired records breaking SSAS Cube if not present?

View previous topic View next topic Go down

Expired records breaking SSAS Cube if not present?

Post  ian.coetzer on Mon Aug 15, 2011 4:16 am

Hi,
We implemented change tracking - in other words - if a record in the source system is deleted - then in the data warehouse the corresponding dimension record is flagged as expired (RowIsCurrent = 'N').

Now when I filter out all expired records in the SSAS Cube - the cube processing fails since some fact records still need the expired dimension records.

So I tried to be clever and filtered out our dimension records as follows - but still it did not work:

SELECT * FROM DimAccount WITH(NOLOCK)
WHERE RowIsCurrent = 'Y'
OR AccountKey IN (SELECT DISTINCT AccountKey FROM FactGLJournalEntry WITH(NOLOCK))
OR AccountKey IN (SELECT DISTINCT AccountKey FROM FactBudget WITH(NOLOCK))

This was the error message - which i cannot understand why this calculated measure fails to process when i use this filter???
The field it mentions (profit)/loss ... is not even in the account dimension?

MdxScript(Finance) (46, 57) The level '[(Profit)/loss for the period]' object was not found in the cube when the string, [Account].[Account].[(Profit)/loss for the period], was parsed.

The END SCOPE statement does not match the opening SCOPE statement.

MdxScript(Finance) (48, 1) The END SCOPE statement does not match the opening SCOPE statement.
avatar
ian.coetzer

Posts : 57
Join date : 2010-05-31
Age : 36
Location : South Africa

View user profile

Back to top Go down

Re: Expired records breaking SSAS Cube if not present?

Post  VHF on Mon Aug 15, 2011 10:56 am

It seems like what you are trying to do should work. Does the cube process OK if you select all DimAccount records including the expired ones?

VHF

Posts : 236
Join date : 2009-04-28
Location : Wisconsin, US

View user profile

Back to top Go down

Re: Expired records breaking SSAS Cube if not present?

Post  VHF on Mon Aug 15, 2011 11:56 am

Do you have the dmension type in SSAS set to 'Regular' or 'Account'? I'm not sure that would change anything, just curious.

VHF

Posts : 236
Join date : 2009-04-28
Location : Wisconsin, US

View user profile

Back to top Go down

Re: Expired records breaking SSAS Cube if not present?

Post  hang on Mon Aug 15, 2011 2:57 pm

Is your DimAccount an SCD2 dimension? If you use RowIsCurrent for deletion, you may miss out previous dimension records due to SCD changes when filtering out deleted records. I would have an additional flag if I don't want deleted dimension to influence the aggregate values.

However in regards of cube processing, it is important to make sure the dimension key in fact table must have a unique entry in their respective dimension which is normally enforced by identity surrogate key. So to keep referential integrity and also exclude certain dimension records, you need to filter on the fact tables to exclude those dimension keys that point to the deleted records. To isolate the problem, process the cube by removing the MDX calculated measures first. You may add them back one by one, once successful. And also process dimensions before processing cube. Hope this will help.


hang

Posts : 528
Join date : 2010-05-07
Location : Brisbane, Australia

View user profile

Back to top Go down

Re: Expired records breaking SSAS Cube if not present?

Post  ngalemmo on Mon Aug 15, 2011 3:36 pm

Why would you exclude 'deleted' dimension rows? Historically, they did exist and you have facts associated with them. Not loading those facts would distort the historical record.
avatar
ngalemmo

Posts : 3000
Join date : 2009-05-15
Location : Los Angeles

View user profile http://aginity.com

Back to top Go down

Re: Expired records breaking SSAS Cube if not present?

Post  ian.coetzer on Fri Sep 02, 2011 2:20 pm

Hi

What happened was the business created two accounts called "Test1" and "Test2", then they deleted those.
So of course the ETL flagged those 2 as expired with the row indicator "N" indicating that they are expired (no longer present in the source system)

They then originally asked me to also make the expired accounts 'visible' when browsing the account dimension.

I then went ahead and changed the data source view on the cube to filter out those accounts where the indicator "N".

This worked at first because the two test accounts never had any actual transactions posted again them ...

The problem came in when the business deleted an actual account in the reporting source system.
the ETL of course again expired that specific account - and my filter excluded that account from being pulled through during dimension processing.

But then the fact (measure groups) failed to process since they have transactions in the fact tables with FK's pointing to the account in the account dimension which is not present in the cube dimension due to my filter - causing the processing to fail ...

what do i do now?
avatar
ian.coetzer

Posts : 57
Join date : 2010-05-31
Age : 36
Location : South Africa

View user profile

Back to top Go down

Re: Expired records breaking SSAS Cube if not present?

Post  hang on Fri Sep 02, 2011 4:33 pm

Ian,

The cube process failed because there is a referential violation in the cube when you filter out the dimension record but the dimension key still exists in the fact table.

If the delete operation on dimension is required by business, meaning the users don't want to see the deleted dimension records in the list event for PIT analysis, the best way I can think of is to add a deleted account entry in the dimension, say -1. Then whenever an account becomes deleted, update the fact table and set the corresponding dimension key to -1. Now your cube process should be successful and you will also see how many transactions point to deleted accounts. Hope this will help.

hang

Posts : 528
Join date : 2010-05-07
Location : Brisbane, Australia

View user profile

Back to top Go down

Re: Expired records breaking SSAS Cube if not present?

Post  ian.coetzer on Sun Sep 04, 2011 1:01 pm

Would this not be negating compliance?

If a transaction is in doubt somewhere down the line ad we have to filter through the transactions we will no longer be able to find the original account to which this transaction belonged? even though both have to be expired (fact as well as dimension record) surely the transaction should refer back to the expired account dimension record - even if that is also expired?
avatar
ian.coetzer

Posts : 57
Join date : 2010-05-31
Age : 36
Location : South Africa

View user profile

Back to top Go down

Re: Expired records breaking SSAS Cube if not present?

Post  hang on Sun Sep 04, 2011 6:26 pm

In that case, you don't physically update the fact table. Create a fact table view instead, to reassign those deleted account key to -1, so you still have the referential integrity in the cube. Hope this is clear enough.

hang

Posts : 528
Join date : 2010-05-07
Location : Brisbane, Australia

View user profile

Back to top Go down

Re: Expired records breaking SSAS Cube if not present?

Post  ian.coetzer on Mon Sep 05, 2011 4:48 am

Hi Hang
Thank You, very very interresting idea!

I will probably just use the SSAS - DSV ( Data Source View) and change the fact table to a named query and make all the current fact records which reference an expired account to display the account key to -1.

If users do not want to see the test accounts in future - i will certainly make this kind of enhancement to the cube.
Then everyone is happy and from a compliance point of view the transactions in the fact table are original - and has not been tampered with.
avatar
ian.coetzer

Posts : 57
Join date : 2010-05-31
Age : 36
Location : South Africa

View user profile

Back to top Go down

Re: Expired records breaking SSAS Cube if not present?

Post  PeteGrace on Mon Sep 05, 2011 3:46 pm

Something else you could consider is having a more descriptive (Type 1) attribute to indicate whether a given account in the dimension has been deleted or not e.g. account_status_flag with values of "Deleted Account" vs. "Live Account".

That way you retain all the data about the account which may have been true at the time of the transaction in the fact, but give your users the visibility if they need it that an account has been deleted, and the ability to filter out deleted accounts.

PeteGrace

Posts : 7
Join date : 2011-09-01

View user profile

Back to top Go down

Re: Expired records breaking SSAS Cube if not present?

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum