dax-optimization

Diagnose and optimize slow DAX queries using trace timings, query plans, and cardinality rules.

571|192|Updated May 16, 2024
One-click install
npx skills add https://github.com/microsoft/semantic-link-labs --skill dax-optimization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dax-optimization
Source: https://github.com/microsoft/semantic-link-labs/tree/main/.claude/skills/dax-optimization
Command: npx skills add https://github.com/microsoft/semantic-link-labs --skill dax-optimization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Slow DAX queries in Power BI and Microsoft Fabric semantic models are hard to diagnose because bottlenecks can hide in the Formula Engine, the Storage Engine, high-cardinality columns, or the query syntax itself. This Skill provides a structured methodology plus an executable rule catalog that turns trace events, query plans, and Vertipaq statistics into concrete, prioritized optimization findings.

Core Features & Use Cases

  • Engine balance analysis: Splits total duration into Formula Engine vs Storage Engine time from trace events to determine whether the query is FE-bound or SE-bound.
  • Executable rule catalog: A declarative JSON ruleset (17 rules) detects CallbackDataID, IFERROR usage, FILTER over full tables, nested iterators, high-cardinality columns, slow SE scans, and more, each with severity, message, recommendation, and references.
  • Cardinality and plan inspection: Uses Vertipaq Analyzer statistics and physical query plan operators (spools, scans, callbacks) to pinpoint expensive columns and materializations.
  • Use Case: A report visual takes 8 seconds to render. Run the query in the DAX test widget, capture the trace and query plan, and the rule engine reports that IFERROR inside an iterator forces CallbackDataID, recommending DIVIDE and precomputed variables instead.

Quick Start

Ask the assistant to analyze why your DAX query is slow using the dax-optimization methodology and rule catalog, providing the query text and any captured trace or query plan.

Frequently Asked Questions about dax-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find out why my DAX query is slow?

Capture a server-side trace and the DAX query plan, then split total duration into Storage Engine and Formula Engine time. SE-bound queries need cardinality and data volume reduction; FE-bound queries need fewer callbacks, less materialization, and set-based logic.

What is CallbackDataID in a DAX query plan?

CallbackDataID means the Storage Engine called back into the single-threaded Formula Engine mid-scan, disabling VertiPaq optimizations. It is usually caused by IF, IFERROR, raw division, or conditional logic inside iterators, and is the top red flag in a physical plan.

How do I reduce high column cardinality in VertiPaq?

Split datetime columns into separate date and time columns, round or bucket numeric values, convert high-cardinality floating point columns to fixed decimal or integer, and drop unused keys. Focus on columns the query actually references.

Should I use FILTER or KEEPFILTERS in DAX?

For a simple column predicate, use KEEPFILTERS(Table[Column] = value) so the predicate is pushed to the Storage Engine. FILTER over an entire table materializes all rows and forces row-by-row Formula Engine evaluation, especially when testing a measure.

Can I add custom rules to the DAX performance analysis?

Yes. Add a rule object to both JSON copies of the rule catalog, and if it needs a new metric or collection, extend build_context() in _dax_optimization.py. Each rule needs an id, severity, condition, message, recommendation, and at least one authoritative reference.

Why are some optimization rules skipped during analysis?

Each rule declares required artifacts such as trace, query plan, or Vertipaq statistics, and is skipped when any are missing. Vertipaq rules are also skipped when all Data column cardinalities are 1, since there is nothing meaningful to analyze.