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 453 stars 114 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
5 months ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category