| name | Power BI Partitions & Expressions |
| description | Manage Power BI table partitions, named expressions (M/Power Query data sources), and calendar table configuration using pbi-cli. Invoke this skill whenever the user mentions "partitions", "data sources", "M expressions", "Power Query", "incremental refresh", "named expressions", "connection parameters", or wants to configure how tables load data. For broader modeling tasks (measures, relationships, hierarchies), see power-bi-modeling instead. |
| tools | pbi-cli |
Power BI Partitions & Expressions Skill
Manage table partitions, named expressions (M queries), and calendar tables.
Prerequisites
pipx install pbi-cli-tool
pbi-cli skills install
pbi connect
Partitions
Partitions define how data is loaded into a table. Each table has at least one partition.
pbi partition list --table Sales
pbi --json partition list --table Sales
pbi partition create "Sales_2024" --table Sales \
--expression "let Source = Sql.Database(\"server\", \"db\"), Sales = Source{[Schema=\"dbo\",Item=\"Sales\"]}[Data], Filtered = Table.SelectRows(Sales, each [Year] = 2024) in Filtered" \
--mode Import
pbi partition create "Sales_Live" --table Sales --mode DirectQuery
pbi partition delete "Sales_Old" --table Sales
pbi partition refresh "Sales_2024" --table Sales
Named Expressions
Named expressions are shared M/Power Query definitions used as data sources or reusable query logic.
pbi expression list
pbi --json expression list
pbi expression get "ServerURL"
pbi --json expression get "ServerURL"
pbi expression create "ServerURL" \
--expression '"https://api.example.com/data"' \
--description "API endpoint for data refresh"
pbi expression create "DatabaseServer" \
--expression '"sqlserver.company.com"' \
--description "Production database server name"
pbi expression delete "OldSource"
Calendar Tables
Calendar/date tables enable time intelligence in DAX. Mark a table as a date table to unlock functions like TOTALYTD, SAMEPERIODLASTYEAR, etc.
pbi calendar list
pbi --json calendar list
pbi calendar mark Calendar --date-column Date
pbi table mark-date Calendar --date-column Date
Workflow: Set Up Partitioned Table
pbi table create Sales --mode Import
pbi partition create "Sales_2023" --table Sales \
--expression "let Source = ... in Filtered2023" \
--mode Import
pbi partition create "Sales_2024" --table Sales \
--expression "let Source = ... in Filtered2024" \
--mode Import
pbi partition refresh "Sales_2024" --table Sales
pbi --json partition list --table Sales
Workflow: Manage Data Sources
pbi --json expression list
pbi expression create "ServerName" \
--expression '"prod-sql-01.company.com"' \
--description "Production SQL Server"
pbi expression create "DatabaseName" \
--expression '"SalesDB"' \
--description "Production database"
pbi --json expression list
Best Practices
- Use partitions for large tables to enable incremental refresh
- Refresh only the partitions that have new data (
pbi partition refresh)
- Use named expressions for shared connection parameters (server names, URLs)
- Always mark calendar tables with
pbi calendar mark for time intelligence
- Use
--json output for scripted partition management
- Export model as TMDL to version-control partition definitions:
pbi database export-tmdl ./model/