Using tabular model perspectives to restrict which tables a user sees
Part two of a two-part series of blogs

Perspectives in SSAS tabular are windows which allow you to control who sees which bits of your model. They're really easy to set up, as this blog shows, but aren't a substitute for setting security roles.

  1. An overview of perspectives in tabular models
  2. Creating and using perspectives in SSAS Tabular (this blog)

This blog is part of our online SSAS Tabular tutorial; we also offer lots of other Analysis Services training resources.

Posted by Andy Brown on 18 February 2016

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Creating and using perspectives in SSAS Tabular

This page shows you how to set up and use perspectives in a tabular model.

Creating perspectives

Assuming you're editing a model, here's how to create a perspective of it (onto it? over it?).  First go into the Perspectives menu:

The perspectives menu

Choose to create a new perspective from the menu.

Now choose to create a new perspective:

New perspective button

Here we've already created one perspective called Retail expert, and are about to add another.

 

You can now tick the tables and columns you want to be visible in your new perspective, as well as giving it a name:

The biologist perspective

Here we're letting biologists view the classification of products bought, but that's about all.

When you've finished, select OK.

Using perspectives within a model

There's a drop down menu on the main SSAS toolbar which allows you to change perspective for a model:

Choosing a perspective in Visual Studio

Simply click on the drop arrow and choose to view one of the perspectives that you've created.

Note that if you didn't include id fields in your perspective, your tables would now appear unrelated:

Unlinked tables in perspective

How the tables would appear if you'd unticked the id fields when creating the Biologist perspective.

However, the id fields (and relationships between them) are still part of your model, so that you'll still get sensible pivot tables based on it:

Pivot table including relationships

Even though you can't see the id columns or the relationships joining them, they still form part of your model, allowing you to aggregate data correctly.

 

Creating pivot tables based on a perspective

When you create a pivot table from SSAS tabular, you can choose the perspective:

Choosing perspective for pivot table

Choose from the drop down list who you want to be!

Excel displays only those tables and columns which are:

  • Included in the model; and
  • Not hidden from client view; and
  • Included within your perspective.

Here's what you'd see for our Biologist perspective:

Fields for biologist perspective

You can only see columns which are included in the perspective and which aren't hidden from client view.

 

Changing the perspective for a data connection

If you have a connection (for example, in Excel), you can change which perspective it uses as follows.  First display the connection you want to change:

Choosing a connection

In Excel you'd first choose to click on this tool on the Data ribbon.

Choose to change the properties of this connection:

Changing connection properties

Click on this button to change the properties of your connection.

You can now fill in the dialog box which appears as shown below:

Connection properties

Step 1: click on the Definition tab;  Step 2: type in a valid perspective name;  Step 3: select OK.

Note that you can also type in the command text as the word Model, to revert to viewing everything.

Changing the perspective when browsing a cube in SSMS

If you're in Management Studio browsing a tabular model, you can change which perspective you're using too:

Changing perspective in SSMS

Click on the build button next to the word Model, as shown above.

You can then select the perspective that you want to show:

Choose perspective from list

Choose which of the perspectives you've created that you want to use.

 

And that's about everything you can do with perspectives.  I really like the way Microsoft have implemented them: nice and simple, which is always a good thing in software. 

  1. An overview of perspectives in tabular models
  2. Creating and using perspectives in SSAS Tabular (this blog)
This blog has 0 threads Add post