DCSIMG
Why are rows (still) missing from a SSAS cube? - Ella Maschiach's BI Blog

Ella Maschiach's BI Blog

BI, Olap Technologies, Tools, System Analysis and Design

News

About Ella Maschiach

Business Inteligence

Why are rows (still) missing from a SSAS cube?

Not too long ago my boss Yaniv got a telephone from one of our customers saying that he thought a cube was missing some values from it. The thing is that at first that didn't sound logical to us because usually we would get an error on that. We expected the process of the cube to fail, or something of that sort. But not this time. Now, there's a few reasons why there are rows missing from a cube as recently blogged by Richard Lees. But our reason was slightly different.

We were using a view in the DSV. The view in the DB was a union of the original dimension table and a referential integrity of the dimension against the relevant fact table. That way we could ensure not falling in the process. What we found out was that the cube process really didn't fail, but we didn't see all the values added through the union, just the original values. What was even weirder was that turning the view into a table in the DB and using that in the DSV gave us back those missing keys. Also, using a named query in the DSV of type: Select * From X also worked in bringing those values back. But adding to that query another filed such as: last_name + ' ' + first_name as Z, again made the added keys disappear…

So yes, I know the conclusion is to do it all in the ETL phase and get a readymade table and not a view (I know, I know!), but just in case you also have a view in your DSV with a union clause in it, then maybe you should run a few checks…

Comments

mikypuff said:

As you said, poor design bring poor results and serious bugs. Give yourself a favor and fix it in the ETL right away... :-)

Miky

# September 19, 2011 8:56 PM

Ella Maschiach said:

I agree with you that the thought process didn't work well here.. Still, I always post even mistakes, because I know that even if I made a mistake - I'm probably not the only one who ever made it...

# September 20, 2011 3:48 PM

Mark Frawley (NYC, US) said:

Love your blog Ella.  Must comment on this entry though.

You don't explain *what* use of UNION has to do with the missing rows.  I can only assume you were using UNION rather than UNION ALL, and that something about the structure and data of your problem query causes the distinct that UNION does to make your rows disappear ?  That would not happen though if the query included a unique identifier of each row.  You don't reveal enough to understand.

Also, at least based on the facts provided, I see nothing wrong in principle with the use of views rather than doing the work in ETL, except perhaps in performance - but performance was not mentioned as an issue.  You seem quite ready to agree with mikypuff that this was a case of poor design, but based on what you've revealed, I don't see it.  The devil is in the details of course.

# October 12, 2011 8:50 PM

Ella Maschiach said:

Hi Mark,

First of all, thank you for the compliment :)

Secondly, the Union was used to add a row to the original dimension. Basically, it added a fictitious worker with a key (-1) to the dimension to connect it to all the debts in the fact that were issued a fictitious office worker. We used Union and not Union All, though we could have used the latter (as there is never a worker with a negative ID). The original table didn’t have a metadata of a column being a unique key. In any case, I’m not sure that sort of metadata can be read in a named query we create in a DSV over a table.
I don’t remember having that problem in the past so I am asking myself if it’s a matter of a bug in SSAS 2008 R2 or if I just didn’t notice that bug till now?....

I’m not saying using named queries or a view is bad in general. Still, in this example, we see that using a readymade table works fine whereas using a named query does not. In that case, I agree with Miky, that had I done it the ETL way, I would have avoided the whole problem.

I hope that added enough details on the matter. Otherwise, please don’t hesitate asking more questions.

Thank you for your feedback,
Ella

# October 16, 2011 5:26 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: