Daily DAX : Day 412 INFO.PERSPECTIVES
INFO.PERSPECTIVES() – DAX Function
Category: Information function (Tabular model metadata)
Syntax
INFO.PERSPECTIVES()
Returns a table containing all perspectives defined in the current Tabular model.
Returned Table Columns
| Column Name | Description |
|---|---|
PerspectiveName |
Name of the perspective (string) |
PerspectiveID |
Internal ID of the perspective |
Description |
Description entered in the model (can be blank) |
Common Use Cases
- Dynamic perspective selector in reports
Let end users choose which perspective they want to see (Sales, Finance, HR, etc.) - Security / role-based visibility
Show only relevant perspectives to certain user groups - Documentation & auditing
Generate a list of all available perspectives in the model - Conditional formatting or slicer population
Build a slicer that lists all perspectives instead of hard-coding them
Example – Create a Perspective Slicer
-- 1. Create a calculated table for the slicer (do this once)
Perspective List =
SELECTCOLUMNS(
INFO.PERSPECTIVES(),
"Perspective", [PerspectiveName]
)
-- 2. Create a measure that respects the selected perspective
Current Perspective =
VAR SelectedPersp = SELECTEDVALUE('Perspective List'[Perspective])
RETURN
IF(
IF(
SelectedPersp = BLANK(),
"All Perspectives",
SelectedPersp
)
)
Then use Perspective List[Perspective] as a slicer.
To actually switch the perspective in Power BI, you still need to use the “Perspective” feature in the connection string or Power BI’s Field List → Perspective dropdown (INFO.PERSPECTIVES only lists them, it does not apply them).
Note: INFO.PERSPECTIVES() is available only in Tabular models (Power BI Desktop with imported or DirectQuery models, Analysis Services Tabular, Azure Analysis Services).
It does not exist in Excel Power Pivot or older Multidimensional models.
Summary
INFO.PERSPECTIVES() is a simple but powerful metadata function that returns all perspectives defined in your model, enabling dynamic, user-friendly perspective selection and documentation.
Comments
Post a Comment