top of page

Perspectives in Power BI semantic models

Perspectives in semantic models are a way to add multiple presentation layers to your semantic model. With perspectives you can choose 1 or more subset of the model to provide a focused view per audience or topic. They are not a security feature; the other fields are simply hidden in the perspective. You can also think of it as multiple ways to hide/show fields in a model.


Field: a column, table, or measure!


Let's take a look at these perspective topics in this blog post:


  1. Hiding vs perspectives

  2. Authoring in Power BI Desktop with TMDL view

  3. Using perspectives in live connect reports in Power BI Desktop

  4. Using perspectives in the Personalized visuals feature

  5. Analyzing perspectives with a DAX query


First, as a best practice, if a field is truly not needed, don't include it in the semantic model until it is. This blog focuses on fields needed for the semantic model and not needed directly for creating a report.


So, what are these fields you need for modeling but not used when building a report? These are fields in the model a report creator would not use it in a visual directly. ID columns for building relationships, a base measure, data columns or the entire Fact table now you have measures aggregating data columns, etc. They are needed indirectly but not directly used in the visuals themselves.


Let's use my model as an example:

Semantic model with many tables and fields to choose from!
Semantic model with many tables and fields to choose from!

How can we reduce the metadata noise for the report creator?


You can hide extra fields you don't expect to users to use in a report. In the Model view there is a right-click menu item called "Hide in report view".


Hiding fields not needed by report authors in Power BI Desktop
Hiding fields not needed by report authors in Power BI Desktop

Report view has it as simply "Hide". And you can "View hidden" in Report view, so it's still available for report creators who really want to find it. Hiding may be all you need.


In the case where you are thinking, for these users they would be interested in these fields and another group is interested in a slightly different group of fields, now you want to consider perspectives. Perspectives are basically named hide/show views of the model. Also, sometimes it's faster to pick what you want to show versus hiding everything you don't want to show!


Creating perspectives was previously limited to just editing via XMLA in SQL Server Management Studio or by using an external tool, such as Tabular Editor. You can still do that, but with the addition of TMDL (Tabular Model Definition Language) view in Power BI Desktop, you can now add them right in Power BI Desktop! Learn more at https://learn.microsoft.com/en-us/%20power-bi/transform-model/desktop-tmdl-view


So here is a quick tutorial. Open a model in Power BI Desktop and go to TMDL view.


Creating or editing perspectives with TMDL view in Power BI Desktop
Creating or editing perspectives with TMDL view in Power BI Desktop

TMDL scripts start with createOrReplace at the top. You can just do create if you are worried about not overwriting something.


Then one indent, perspective and the name of it. You can put it in single quotes to add a space to the name.


Then next line, indent again and you start listing what tables you want in it. Each table on a new line with perspectiveTable 'Table name'.


Then next line, after each table line, indent again and include what you want from this table. You have a couple of options.

  1. includeAll: True adds all things and you are done. Also new things automatically show.

  2. perspectiveColumn 'Column name' to add a specific column. Each column on a new line.

  3. perspectiveMeasure 'Measure name' to add a specific measure. Each measure on a new line.

  4. perspectiveHierarchy 'Hierarchy name' to add a specific hierarchy. Each hierarchy on a new line and it adds all members. Another easy to way to add multiple columns at once.


And that's it until you are done. You can add multiple perspective in one script or add them in their own script.


Auto-fix up works, so if you change your home table on a measure, it will auto-fix up and the new table will show in the perspective. Renames are also no trouble.


Here is the image script in text. Using the Format button in the ribbon will add more white space.


createOrReplace

	perspective Sales
		perspectiveTable 'Product'
			perspectiveColumn 'Product'
			perspectiveColumn 'Model Name'
			perspectiveColumn 'Product Line'
			perspectiveColumn 'Description'
		perspectiveTable 'Product Category'
			perspectiveColumn 'Product Category'
		perspectiveTable 'Product Subcategory'
			perspectiveColumn 'Product Subcategory'
		perspectiveTable 'Customer'
		perspectiveTable 'Date'
			perspectiveHierarchy 'Date Hierarchy'
		perspectiveTable 'All orders'
			perspectiveMeasure 'Orders'
			perspectiveMeasure 'Quantity sold'
			perspectiveMeasure 'Sales amount USD'
		perspectiveTable 'Time Intelligence'
			includeAll: True


	perspective ProductInfo
		perspectiveTable 'Product'
			includeAll: True

To edit a perspective later, just drag the perspective from the Model explorer of the Data pane into the script window.


Perspectives show in the Model explorer of the Data pane and can be dragged into TMDL view script editor to edit later
Perspectives show in the Model explorer of the Data pane and can be dragged into TMDL view script editor to edit later

To delete a perspective, script the entire model by dragging the Semantic model node in Model explorer to the script window. Find the perspective in the long script, delete it, then Apply changes.


Now you have perspectives, now what?


You can use perspectives in a live connect report in Power BI Desktop. But not the usual way by going to Get Data or OneLake catalog > Power BI semantic model. You use Get Data > Analysis services connector. This path is a premium or Fabric capacity only feature.


  1. Publish the semantic model you created the perspectives into a workspace that's in premium or a Fabric capacity.

  2. Get the Server, which can be found in web modeling by clicking on Data pane > Model > Semantic model and getting from the Properties pane.

    The Server can be found in web modeling by going to "Open semantic model" in the service
    The Server can be found in web modeling by going to "Open semantic model" in the service

    Or you can go to Workspace settings > License info > Connection link.

    The Server of a Power BI / Fabric workspace
    The Server of a Power BI / Fabric workspace
  3. Open blank Power BI Desktop file, go to Get Data > Analysis services

    Use the Analysis services connector to live connect to a perspective
    Use the Analysis services connector to live connect to a perspective
  4. Paste in that Server. Connect live should be chosen, then hit OK.

    Live connect to a published Power BI semantic model in live connect and use a perspective.
    Live connect to a published Power BI semantic model in live connect and use a perspective.
  5. As this is getting it from the service, choose Microsoft account to connect.

  6. Now you can pick your semantic model and perspective and click OK.

    Picking the perspective you want to connect to
    Picking the perspective you want to connect to
  7. And you are live connected to that perspective to create a report.

    Report authoring is streamlined with less clutter
    Report authoring is streamlined with less clutter
  8. You can always View hidden to see all the fields in the model.

    See fields outside of the perspective with View hidden
    See fields outside of the perspective with View hidden

For pro or even not logged in users I can show you how to do it locally, to see how it works with the connector.


  1. In the local model (PBIX open in Power BI Desktop) you added perspectives to, go to Model view.

  2. In the Data pane, change to Model, and click on Semantic model node.

  3. In the Properties pane, copy the Server value. Should be localhost:12345 (some random 5-digit number).

    Get the server of a local PBIX file
    Get the server of a local PBIX file
  4. Open blank Power BI Desktop file, go to Get Data > Analysis services

    Use the Analysis services connector to live connect to a perspective
    Use the Analysis services connector to live connect to a perspective
  5. Paste in that Server. Connect live should be chosen, then hit OK.

    Add the server and live connect to the other PBIX file
    Add the server and live connect to the other PBIX file
  6. As this is locally on your machine, choose Windows to connect.

  7. Now you can pick your perspective and click OK.

    The perspectives are listed
    The perspectives are listed
  8. The report data pane only shows the things you picked!

    The perspective tables/columns/measures showing in the report view.
    The perspective tables/columns/measures showing in the report view.
  9. You can choose "View hidden" to show all the rest if you want.

    View hidden can always show the other tables/columns/measures
    View hidden can always show the other tables/columns/measures
  10. If you publish this one, it won't work, but it is to demonstrate how it works if you don't have premium or a Fabric capacity available to you.


And for pro users, you can still use them by creating changing a live connection to DirectQuery to semantic model connection by clicking "Make changes to this model". In that screen you will see the perspectives as an option.


The personalized visuals feature is a cool way to allow your report consumers (not editors) to customize a visual you choose in a report. They can change the visual type (line chart to bar chart for example) and pick different fields to display. They are limited to using just the fields you choose when you assign a perspective to this feature. Learn more at https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-personalize-visuals. A quick start guide is as follows:


  1. In the report, go to File > Options and Settings > Options and in the Current file section choose Report settings. Click the check box next to Allow report readers to personalize visuals to suit their needs.

    Turn on personalize visuals in this report
    Turn on personalize visuals in this report
  2. Now you see the header icon for it on the visual. It won't do anything until it's published.

    The header icon in Power BI Desktop shows, but won't do anything until this report is published
    The header icon in Power BI Desktop shows, but won't do anything until this report is published
  3. Open page Format pane and there is a Personalize visual section where you can specify the perspective you want consumers to use.

    Page format settings let you pick a perspective per page to use with personalize visuals
    Page format settings let you pick a perspective per page to use with personalize visuals
  4. Then publish and check out your new experience. The name of the perspective will be visible to users.

    Personalize visuals working in a published Power BI report
    Personalize visuals working in a published Power BI report

Finally, I can quickly see what all is available in a perspective with DAX query view. To run this script you would need to have edit permission on the semantic model. You can run it in DAX query view in Desktop, in the service, or even in an external tool or Fabric notebook. Learn more at DAX query view - Power BI | Microsoft Learn and Read data from semantic models and write data that semantic models can consume using python - Microsoft Fabric | Microsoft Learn

Use a DAX query to see all the fields used in each perspective
Use a DAX query to see all the fields used in each perspective

Here is the DAX query I have here. It can be modified to add in additional columns too.


EVALUATE 
VAR perspectiveNames = SELECTCOLUMNS(INFO.PERSPECTIVES(), "PerspectiveID", [ID], "Perspective", [Name])
VAR perspectiveTables = SELECTCOLUMNS(NATURALINNERJOIN(INFO.PERSPECTIVETABLES(), perspectiveNames), "PerspectiveTableID", [ID], "TableID", [TableID], [PerspectiveID], [Perspective], [IncludeAll])
VAR tablesInfo = NATURALINNERJOIN(SELECTCOLUMNS(INFO.VIEW.TABLES(), "TableID", [ID], "Table", [Name], [IsHidden]), perspectiveTables)
VAR columnsinfo = NATURALINNERJOIN(SELECTCOLUMNS(FILTER(INFO.VIEW.COLUMNS(),[Type] <> "RowNumber"), "ColumnID", [ID], "Column", [Name], "Table", [Table]), tablesInfo)
VAR measuresinfo = SELECTCOLUMNS(INFO.VIEW.MEASURES(), "MeasureID", [ID], "Field", [Name], [Table], [IsHidden])
VAR perspectiveCols = SELECTCOLUMNS(NATURALINNERJOIN(INFO.PERSPECTIVECOLUMNS(), columnsinfo), "Field", [Column], [Table], [IsHidden], [Perspective], "Type", "Column")
VAR perspectiveColsAll = SELECTCOLUMNS(NATURALINNERJOIN(filter(tablesInfo, [IncludeAll] = True()), columnsinfo), "Field", [Column], [Table], [IsHidden], [Perspective], "Type", "Column")
VAR perspectiveColsHierarchy = SELECTCOLUMNS(NATURALINNERJOIN(SELECTCOLUMNS(NATURALINNERJOIN(NATURALINNERJOIN(INFO.PERSPECTIVEHIERARCHIES(), tablesInfo), SELECTCOLUMNS(INFO.LEVELS(), [HierarchyID], [ColumnID])), [ColumnID], [Table], [Perspective], "Type", "Hierarchy column"),columnsinfo), "Field", [Column], [Table], [IsHidden], [Perspective], [Type])
VAR perspectiveMeasures = SELECTCOLUMNS(NATURALINNERJOIN(NATURALINNERJOIN(INFO.PERSPECTIVEMEASURES(), measuresinfo), perspectiveTables), [Field], [Table], [IsHidden], [Perspective], "Type", "Measure")
VAR combined = 
UNION(
	perspectiveCols,
	perspectiveColsAll,
	perspectiveColsHierarchy,
	perspectiveMeasures
)
RETURN
combined

Hope this helps you understand and use perspectives in Power BI semantic models!

 
 
 

© 2021-2025 by Zoe Douglas (DataZoe). Proudly created with Wix.com.

  • GitHub
  • LinkedIn
bottom of page