DAX Formula Reviewer: Catch Slow Power BI Patterns

    1

    **DAX Formula Reviewer** is an offline, comment- and string-aware Python static parser and linter for Power BI semantic model measures.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    DAX Formula Reviewer: Catch Slow Power BI Patterns

    Example session with this skill installed

    Review my Power BI DAX measures in examples/sales_measures.dax, rank all performance and correctness anti-patterns by severity, calculate a health score, and write concrete DAX rewrites into examples/sample_output without modifying my original file.

    • Read your context and instructions
    • Compiled the dax formula reviewer

    Verified CLI execution output on examples/sales_measures.dax:

    DAX Review Complete | Measures: 10 | Findings: 13 (C:2 H:5 M:4 L:2) | Health Score: 83.7/100 (B)
    Outputs written to: D:\agensi-skills\skills\dax-formula-antipattern-reviewer\examples\sample_output
      - report: dax_review_report.md
      - csv: dax_findings.csv
      - json: dax_summary.json
      - dax: dax_rewrites.dax
    

    Generated examples/sample_output/dax_review_report.md excerpt:

    
    # DAX Formula Anti-Pattern Review Report
    
    - **Input Target:** `sales_measures.dax`
    - **Measures Analyzed:** 10
    - **Clean Measures:** 2 | **Flagged Measures:** 8
    - **Total Findings:** 13 (CRITICAL: 2, HIGH: 5, MEDIUM: 4, LOW: 2)
    - **Overall DAX Health Score:** **83.7 / 100 (Grade B)** (Median: 81.0, P25: 72.8)
    
    ## Measure Health Scorecard
    
    | Table | Measure | Score | Grade | Critical | High | Medium | Low |
    | --- | --- | ---: | :---: | ---: | ---: | ---: | ---: |
    | FactSales | Margin Tier Label | 69 | C | 0 | 1 | 2 | 0 |
    | FactSales | High Value North Orders | 70 | C | 0 | 2 | 0 | 0 |
    | FactSales | 2025 YTD via Format | 72 | C | 1 | 0 | 0 | 1 |
    | FactSales | Electronics Revenue (Slow) | 75 | B | 1 | 0 | 0 | 0 |
    | FactSales | Gross Margin % | 77 | B | 0 | 1 | 1 | 0 |
    | FactSales | Active Store Customers | 85 | B | 0 | 1 | 0 | 0 |
    | FactSales | Unqualified Net Sum | 92 | A | 0 | 0 | 1 | 0 |
    | FactSales | High Ticket Order Count | 97 | A | 0 | 0 | 0 | 1 |
    | FactSales | Total Revenue | 100 | A | 0 | 0 | 0 | 0 |
    | FactSales | Clean YoY Revenue Growth % | 100 | A | 0 | 0 | 0 | 0 |
    
    
    ## Severity-Ranked Findings & Rewrites
    
    ### 1. [CRITICAL] DAX001 — `FactSales[Electronics Revenue (Slow)]` (Line 11)
    - **Category:** Storage Engine & Filter Context
    - **Detected Pattern:** `FILTER ( ALL ( 'DimProduct'[Category] ), 'DimProduct'[Category] = "Electronics" )`
    - **Why It Hurts:** FILTER(ALL(...)) inside CALCULATE() forces row-by-row Formula Engine iteration over an expanded table instead of Storage Engine pushdown.
    - **Recommended Rewrite:** `Use direct boolean filter or REMOVEFILTERS: CALCULATE(<expr>, REMOVEFILTERS('DimProduct'[Category]), 'DimProduct'[Category] = "Electronics")`
    
    ### 2. [CRITICAL] DAX001 — `FactSales[2025 YTD via Format]` (Line 47)
    - **Category:** Storage Engine & Filter Context
    - **Detected Pattern:** `FILTER ( ALL ( 'DimDate'[Date] ), FORMAT ( 'DimDate'[Date], "yyyy" ) = "2025" )`
    - **Why It Hurts:** FILTER(ALL(...)) inside CALCULATE() forces row-by-row Formula Engine iteration over an expanded table instead of Storage Engine pushdown.
    - **Recommended Rewrite:** `Use direct boolean filter or REMOVEFILTERS: CALCULATE(<expr>, REMOVEFILTERS('DimDate'[Date]), FORMAT ( 'DimDate'[Date], "yyyy" ) = "2025")`
    
    ### 3. [HIGH] DAX002 — `FactSales[Gross Margin %]` (Line 15)
    - **Category:** Runtime Safety & Error Handling
    - **Detected Pattern:** `( [Total Revenue] - [Total Cost] ) / [Total Revenue]`
    - **Why It Hurts:** Raw '/' division operator can return Infinity/-Infinity or runtime errors when denominator is 0 or BLANK().
    - **Recommended Rewrite:** `DIVIDE(( [Total Revenue] - [Total Cost] ), [Total Revenue], 0)`
    

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Slow Power BI report pages rarely come from data volume alone—they usually stem from a handful of costly DAX patterns hidden inside measure definitions: FILTER(ALL(...)) forcing row-by-row Formula Engine scans, raw / division returning Infinity, bidirectional CROSSFILTER(..., BOTH) traps, nested CALCULATE() context transitions, IFERROR() disabling Storage Engine batch pushdown, and uncached repeated [Measure] calls.

    DAX Formula Reviewer is an offline, comment- and string-aware Python static parser and linter for Power BI semantic model measures. It audits .dax, .txt, .csv, .json, and .jsonl exports (or whole folders of scripts) without requiring Power BI Desktop, Excel, or a live Analysis Services connection.

    What It Checks (DAX001–DAX010)

    • CRITICAL (DAX001): FILTER(ALL(...)) / FILTER(ALLSELECTED(...)) inside CALCULATE() or iterators, with REMOVEFILTERS() / boolean predicate rewrites.
    • HIGH (DAX002–DAX005): Unguarded / division without DIVIDE(), bidirectional CROSSFILTER(..., BOTH) traps, nested CALCULATE() inside CALCULATE() or row iterators, and whole-table FILTER(FactTable, ...) scans.
    • MEDIUM (DAX006–DAX009): Repeated [Measure] references without VAR ... RETURN caching, legacy EARLIER()/EARLIEST(), IFERROR() / dense IF(..., ..., 0) coercion, and unqualified SUM([Col]) column references.
    • LOW (DAX010): COUNTROWS(FILTER(...)), non-sargable FORMAT() inside filter predicates, and ALL() used as a CALCULATE modifier instead of REMOVEFILTERS().

    Deliverables (Strictly Read-Only on Inputs)

    Every run writes four clean outputs into --output-dir without altering your source files:

    1. dax_review_report.md — Executive summary, 0–100 DAX Health Score (A–F), per-measure scorecard, and severity-ranked rewrites.
    2. dax_findings.csv — Flat issue log ready for Excel, Power BI, or sprint backlog tracking.
    3. dax_summary.json — Machine-readable KPIs (mean, median, P25 scores, severity counts, rule counts, findings array) for CI/CD gates (--fail-on-critical).
    4. dax_rewrites.dax — Annotated DAX Studio script showing [CLEAN] vs [FLAGGED] status and suggested rewrites inline above each measure.

    Fits Your BI & Analytics Workflow

    Designed to pair seamlessly with Power BI Model & DAX Helper, Star Schema Designer, and Retail Data Cleaner—including automatic qa_flags CSV row filtering when auditing cleaned metadata exports.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.

    • Performs static lexical/structural analysis without connecting to a live VertiPaq/Analysis Services engine, so it cannot measure actual table cardinalities, relationship directions in .pbix metadata, or query execution timings.
    • .xlsx workbooks are not parsed directly; export measures to .dax, .csv, or .json/.jsonl first.
    • Repeated-measure caching (DAX006) checks whether VAR is present in the measure and flags repeated [Measure] calls when VAR is absent.
    • Suggested rewrites are high-accuracy templates that should be validated against your semantic model's exact filter context and relationship design.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 1 day ago

    • Free with an Agensi account

    Software
    Python 3.9+ with pandas and numpyLocal read access (.dax, .csv, .json, .jsonl)Write access to --output-dirPython
    Optional
    DAX StudioTabular Editor

    Runs 100% locally offline with zero network calls, zero telemetry, and strict read-only handling of original input files.

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Listed1 day ago

    What's inside

    Frequently Asked Questions

    Use DAX Studio (`INFO.MEASURES()` exported to CSV or `DEFINE MEASURE` `.dax` scripts) or Tabular Editor to export measures into `.dax`, `.csv`, or `.json` files, then pass the file or folder to `--input`.

    No. Input files are opened read-only and never overwritten. All reports, CSVs, JSON summaries, and annotated `.dax` rewrites are written to `--output-dir`.

    No. It runs 100% offline using Python 3.9+ standard library plus `pandas` and `numpy`.

    Yes. Pass `--fail-on-critical` to exit with code `2` whenever any `CRITICAL` (`DAX001`) issue is found, or `--min-severity HIGH` to filter out lower-priority notices.

    If a `qa_flags` (or `qa_flag`/`quality_flag`) column is present, rows with non-clean flags are excluded by default and logged in the summary report; pass `--include-flagged` to audit those rows too.

    New in Code Quality & Review

    Free