power-bi-dax

Featured

Write, execute, and optimize DAX queries and measures for Power BI semantic models using pbi-cli. Invoke this skill whenever the user mentions DAX, queries data in Power BI, writes calculations, creates measures, asks about EVALUATE, SUMMARIZECOLUMNS, CALCULATE, time intelligence, or wants to analyze/aggregate data from a semantic model. Also invoke when the user asks to run a query, test a formula, or check row counts. This skill contains critical guidance on passing DAX expressions via CLI arguments -- multi-line DAX (VAR/RETURN) requires special handling.

AI & Automation 424 stars 111 forks Updated today MIT

Install

View on GitHub

Quality Score: 94/100

Stars 20%
88
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Power BI DAX Skill Execute and validate DAX queries against connected Power BI models. ## Prerequisites ```bash pipx install pbi-cli-tool pbi-cli skills install pbi connect ``` ## Executing Queries ```bash # Inline query pbi dax execute "EVALUATE TOPN(10, Sales)" # From file pbi dax execute --file query.dax # From stdin (piping) cat query.dax | pbi dax execute - echo "EVALUATE Sales" | pbi dax execute - # With options pbi dax execute "EVALUATE Sales" --max-rows 100 pbi dax execute "EVALUATE Sales" --timeout 300 # Custom timeout (seconds) # JSON output for scripting pbi --json dax execute "EVALUATE Sales" ``` ## DAX Expression Limitations in CLI When passing DAX as a `-e` argument, the shell collapses newlines into a single line. Simple expressions like `SUM(Sales[Amount])` work fine, but multi-line DAX using VAR/RETURN breaks because the DAX parser needs line breaks between those keywords. **Why this matters:** A measure like `VAR x = [Total Sales] VAR y = [Sales PY] RETURN DIVIDE(x - y, y)` will fail with a syntax error because the engine sees it as one continuous line without statement separators. **Workarounds (pick one):** ```bash # Option 1: Pipe from stdin (recommended for measures) echo 'VAR TotalSales = SUM(Sales[Amount]) VAR TotalCost = SUM(Sales[Cost]) RETURN TotalSales - TotalCost' | pbi measure create "Profit" -e - -t Sales # Option 2: Write to a .dax file and use --file (for queries) echo 'EVALUATE ROW("Result", VAR x = SUM(Sales[Amount...

Details

Author
MinaSaad1
Repository
MinaSaad1/pbi-cli
Created
4 months ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

power-bi-modeling

Create and manage Power BI semantic model structure using pbi-cli -- tables, columns, measures, relationships, hierarchies, calculation groups, and date/calendar tables. Invoke this skill whenever the user says "create table", "add measure", "add column", "create relationship", "date table", "calendar table", "star schema", "mark as date table", "add hierarchy", "calculation group", or any model-building task. Also invoke when creating multiple measures at once -- the skill contains critical guidance on multi-line DAX expression handling.

424 Updated today
MinaSaad1
AI & Automation Featured

power-bi-diagnostics

Troubleshoot Power BI model performance, trace query execution, manage caches, and verify the pbi-cli environment using pbi-cli. Invoke this skill whenever the user says "pbi not working", "setup issues", "connection failed", "slow query", "performance", "profiling", "tracing", "health check", "model audit", "pbi setup", or encounters any pbi-cli error. This is the first skill to check when something goes wrong with pbi-cli.

424 Updated today
MinaSaad1
AI & Automation Listed

power-bi-dax

Use for DAX measure authoring, validation, YAML unit-test suites, filter context reasoning, Time Intelligence patterns, optimisation, and design patterns. Triggers on: "write a DAX", "create a measure", "CALCULATE", "SUMX", "Time Intelligence", "YTD", "DATEADD", "filter context", "DAX not working", "validate this DAX", "pbi measure", "pbi dax", "pbi testing", "dax test suite", "pbi filter", "filter context", "row context", "iterator", "DAX pattern". Do NOT trigger for report visual layout (→ power-bi-report-design), model schema design (→ power-bi-modeling), or governance naming rules (→ power-bi-governance).

0 Updated today
mudassir09