5

I have a set of views set up in SQL Server which output exactly the results that I would like to include in a SQL Server Analysis Services cube, including the calculation of a number of dimensions (such as Age using DATEDIFF, business quarter using DATENAME etc.). What I would like to know is whether it makes sense to use these views as the data source for a cube, or whether I should use the underlying tables to reproduce the logic in SSAS. What are the implications of going either route?

My concerns are:

  • the datasets are massive, but we need quick access to the results, so I would like to have as much of the calculations that are done in the views persisted within the SSAS data warehouse
  • Again, because the datasets are massive I want the recalculation of any cubes to be a fast as possible
Karl
  • 5,573
  • 8
  • 50
  • 73

2 Answers2

9

Many experts actually recommend using views in your data source view in SSAS. John Welch (Pragmatic Works, Microsoft MVP, Analysis Services Maestro) spoke on how he preferred using views in the DSV this year at SQL Rally Dallas. The reason being is that it creates a layer between the cube and the physical table.

Calculating columns in the view will take a little extra time and resources during cube processing. If processing time is ok, leave the computations in the view. If it's an issue, you can always add a persisted computed column directly to the fact table so that the calculation is done during the insert / update of the fact table. The disadvantage of this is that you'll have to physically store the columns in the fact table. The advantage is that they don't have to be computed every time the cube gets processed. These are the tradeoffs that you'll need to weigh to decide which way to go.

Just make sure you tune the source queries to be as efficient as possible. Views are fine for DSVs.

brian
  • 3,635
  • 15
  • 17
  • "creates a layer between the cube and the physical table". True, and this is so important. +1 – Diego Oct 25 '12 at 10:22
4

Views, always! The only advantage of using tables on the DSV is that it ill map your keys automatically :) which saves you 5 minutes of development time haha.

Also, by "use the underlying tables to reproduce the logic in SSAS" you mean creating calculated columns on your SSAS DSV? It is an option too, but I rather add the calculations to the views because, in case I have to uptade them, is MUCH easier (and less subject to failure) to re-deploy a view than to redeploy a full cube.

Diego
  • 34,802
  • 21
  • 91
  • 134
  • 1
    How do you make connections between the views in order to create the cube? My understanding is without PK,FK relations between views, there is no way to create fact table? – OPK Apr 08 '15 at 14:21
  • 1
    The relationships must be manually added in the data source view by dragging the column from the fact view to the dimension view. – RollTide May 12 '15 at 12:44