3 min read
Power BI 2022 Features: What's New and Exciting
Power BI continues to evolve with powerful new features in 2022. From composite models to automatic aggregations, let’s explore what’s new and how to leverage these capabilities.
Composite Models - Connect Everything
Composite models allow you to combine DirectQuery and Import mode in a single dataset:
// Create a calculated table for hybrid scenarios
SalesWithBudget =
NATURALINNERJOIN(
SUMMARIZE(Sales, Sales[ProductID], Sales[Date], "TotalSales", SUM(Sales[Amount])),
Budget // Import mode table
)
Configure in Power BI Desktop:
{
"model": {
"tables": [
{
"name": "Sales",
"mode": "directQuery",
"source": {
"type": "sql",
"connectionString": "Server=sql.database.windows.net;Database=SalesDB"
}
},
{
"name": "Budget",
"mode": "import",
"source": {
"type": "excel",
"path": "Budget2022.xlsx"
}
}
],
"relationships": [
{
"from": "Sales[ProductID]",
"to": "Budget[ProductID]"
}
]
}
}
DirectQuery for Power BI Datasets
Chain datasets together with DirectQuery:
// Connect to another Power BI dataset
let
Source = PowerBI.Datasets(null),
SalesDataset = Source{[Name="Sales Analytics"]}[Data],
SalesTable = SalesDataset{[Name="Sales"]}[Data]
in
SalesTable
Hybrid Tables
Combine real-time and historical data in a single table:
{
"name": "SalesHybrid",
"partitions": [
{
"name": "Historical",
"mode": "import",
"source": {
"expression": "SELECT * FROM Sales WHERE Date < '2022-01-01'"
},
"refreshPolicy": {
"type": "incremental",
"incrementalWindow": "30 days"
}
},
{
"name": "Current",
"mode": "directQuery",
"source": {
"expression": "SELECT * FROM Sales WHERE Date >= '2022-01-01'"
}
}
]
}
Automatic Aggregations
Let Power BI optimize query performance automatically:
{
"model": {
"tables": [
{
"name": "SalesDetail",
"aggregations": {
"enabled": true,
"trainingWindow": "30 days",
"excludedColumns": ["CustomerNotes", "InternalID"]
}
}
]
}
}
Monitor aggregation usage:
// Check aggregation hit ratio
EVALUATE
SUMMARIZE(
INFO.AGGREGATIONS(),
[TableName],
[AggregationTableName],
[HitRatio],
[QueryCount]
)
Smart Narratives
Add AI-generated insights to your reports:
{
"visualType": "smartNarrative",
"dataRoles": [
{
"name": "Values",
"values": ["Sales[Amount]", "Sales[Quantity]"]
},
{
"name": "Category",
"values": ["Product[Category]"]
}
],
"settings": {
"summaryType": "autoSummarize",
"includeOutliers": true,
"highlightTrends": true
}
}
Goals and Scorecards
Track KPIs with the new Goals feature:
{
"scorecard": {
"name": "Sales Performance 2022",
"goals": [
{
"name": "Revenue Target",
"owner": "sales-team@company.com",
"target": 10000000,
"startDate": "2022-01-01",
"endDate": "2022-12-31",
"current": {
"datasetId": "sales-dataset",
"measure": "Total Revenue"
},
"status": {
"rules": [
{ "condition": ">=100%", "status": "OnTrack", "color": "green" },
{ "condition": ">=80%", "status": "AtRisk", "color": "yellow" },
{ "condition": "<80%", "status": "Behind", "color": "red" }
]
}
}
]
}
}
Deployment Pipelines API
Automate report deployments:
import requests
class PowerBIDeploymentPipeline:
def __init__(self, access_token: str):
self.base_url = "https://api.powerbi.com/v1.0/myorg"
self.headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
def deploy_to_stage(self, pipeline_id: str, source_stage: int, target_stage: int):
"""Deploy content from one stage to another."""
url = f"{self.base_url}/pipelines/{pipeline_id}/deployAll"
payload = {
"sourceStageOrder": source_stage,
"options": {
"allowCreateArtifact": True,
"allowOverwriteArtifact": True,
"allowOverwriteTargetArtifactLabel": True
}
}
response = requests.post(url, headers=self.headers, json=payload)
return response.json()
def get_pipeline_operations(self, pipeline_id: str):
"""Get deployment history."""
url = f"{self.base_url}/pipelines/{pipeline_id}/operations"
response = requests.get(url, headers=self.headers)
return response.json()
# Usage
pipeline = PowerBIDeploymentPipeline(access_token)
result = pipeline.deploy_to_stage(
pipeline_id="pipeline-guid",
source_stage=0, # Development
target_stage=1 # Test
)
Enhanced Paginated Reports
<!-- Paginated report with parameters -->
<Report>
<ReportParameters>
<ReportParameter Name="StartDate">
<DataType>DateTime</DataType>
<DefaultValue>
<Values>
<Value>=DateAdd("m", -1, Today())</Value>
</Values>
</DefaultValue>
</ReportParameter>
</ReportParameters>
<DataSets>
<DataSet Name="SalesData">
<Query>
<CommandText>
SELECT * FROM Sales
WHERE Date >= @StartDate
</CommandText>
</Query>
</DataSet>
</DataSets>
</Report>
Power BI in 2022 offers unprecedented flexibility for enterprise analytics with features that scale from simple reports to complex enterprise deployments.