agentleFS
MicrosoftKnown publishermicrosoft/awesome-rayfin/templates/universal-app/.agents/skills/dax/SKILL.md

dax

Skill108 starsChanged 5 months agoMITView on GitHub

Discover Power BI semantic model schemas with DAX INFO functions, decide what belongs in DAX versus TypeScript, and author/test DAX queries for Fabric analytics dashboards.

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 4 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for data-shape decisions: find the model objects, pick the query grain, write DAX, preview the visual, then iterate.

    line 11
  2. Very specific:

    Do not over-tune the query first: write it, render with npm run preview, then fix shape/grain from the report (→ headless-preview).

    line 24
  3. Distinctive:

    Start small; fetch metadata on demand.

    line 37
  4. Very specific:

    Use INFO.VIEW.* first; it is read-access friendly.

    line 52
  5. Very specific:

    Use elevated INFO.* only for calculation groups, calendars, UDFs, or variations.

    line 55
  6. Very specific:

    Run discovery and optional sanity queries with npx fabric-app-data query <alias>.

    line 56
  7. Very specific:

    Use fully qualified columns: 'Table'[Column].

    line 78
  8. Very specific:

    Use simple measure names: [Measure].

    line 79
  9. Very specific:

    Use one DEFINE block; separate VAR / MEASURE declarations by newlines, not commas.

    line 81
  10. Distinctive:

    Prefer existing model measures over raw aggregations.

    line 83
  11. Distinctive:

    Leave BLANKs and visual gap-filling to the app/spec unless the model semantics require otherwise.

    line 92

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

DAX — Discover, Design, Author

Use this skill for data-shape decisions: find the model objects, pick the query grain, write DAX, preview the visual, then iterate.

Fast path: Phase 1 hero slice

  1. Minimal discovery — run one scope probe, then inspect only the tables/measures behind the hero metric.
    npx fabric-app-data query <alias> --query "EVALUATE ROW(\"TableCount\", COUNTROWS(INFO.VIEW.TABLES()), \"ColumnCount\", COUNTROWS(INFO.VIEW.COLUMNS()), \"MeasureCount\", COUNTROWS(INFO.VIEW.MEASURES()), \"RelationshipCount\", COUNTROWS(INFO.VIEW.RELATIONSHIPS()))"
  2. Pick one visual grain — one DAX query should return exactly the rows the hero visual needs.
  3. Prefer model measures — use [Measure] before re-aggregating raw columns.
  4. Write one query, optionally sanity-test it — npx fabric-app-data query <alias> --query '<DAX>'; fix blocking syntax/shape errors only.
  5. Map in TypeScript — DAX computes/fetches; toChartData / toTable maps positional rows; the visual spec handles display.

Do not over-tune the query first: write it, render with npm run preview, then fix shape/grain from the report (→ headless-preview).

Table of contents

NeedRead
Progressive schema discovery, INFO functions, scope/narrowing queriesDiscovery reference
DAX vs TypeScript matrix, filters, multi-grain, highlighting, format strings, anti-patternsDesign reference
DAX syntax, core functions, query patterns, BLANK semantics, time intelligenceDAX reference
CLI connection/query detailsfabric-data

Progressive discovery

Start small; fetch metadata on demand.

User asks for a metric or visual
  -> Know relevant tables?
     -> No: INFO.VIEW.TABLES()
     -> Yes: Know columns/measures?
        -> No: filtered INFO.VIEW.COLUMNS() and INFO.VIEW.MEASURES()
        -> Yes: Need relationship/filter path?
           -> Yes: filtered INFO.VIEW.RELATIONSHIPS()
           -> No: write the visual-grain DAX

Rules:

  • Use INFO.VIEW.* first; it is read-access friendly.
  • Narrow metadata with SELECTCOLUMNS + FILTER.
  • Reuse discovered schema; do not re-fetch the same inventory in one task.
  • Use elevated INFO.* only for calculation groups, calendars, UDFs, or variations; skip if permissions fail after INFO.VIEW.* works.
  • Run discovery and optional sanity queries with npx fabric-app-data query <alias>; see fabric-data for details.

DAX vs TypeScript: responsibility split

ConcernOwner
Measures, aggregations, grouping grain, time intelligenceDAX
TopN, high-cardinality filters, payload reductionDAX
Small UI filters/slicersTypeScript or DAX depending on cost
Deterministic debug orderingDAX ORDER BY
Merging result sets, safe totals from fetched detail, reshaping/pivotingTypeScript
Non-additive totals (DISTINCTCOUNT, ratios, AVERAGEX, complex measures)DAX separate summary query
Column display namestoChartData aliases / toTable columns
Number/date formattingChart spec format, card props, or table/matrix format
Decorative labels/icons/null placeholdersComponent rendering or mapped display fields

Decision check: if it changes meaning, filter context, measure definition, or grain, do it in DAX. If it changes presentation, use TypeScript or the visual spec.

Authoring rules

Must

  • Use fully qualified columns: 'Table'[Column].
  • Use simple measure names: [Measure].
  • Return a table after EVALUATE; wrap scalar results in ROW(...).
  • Use one DEFINE block; separate VAR / MEASURE declarations by newlines, not commas.
  • Aggregate in DAX to the visual's grain; never fetch low-grain rows just to roll them up client-side.
  • Prefer existing model measures over raw aggregations.
  • Optionally quick-test DAX with fabric-app-data query for syntax/shape sanity, then use npm run preview as the visual feedback loop.

Prefer / avoid

  • SUMMARIZECOLUMNS for grouped aggregations.
  • TREATAS as filter arguments in SUMMARIZECOLUMNS.
  • Variables for readability and repeated filters; multiple small queries over one mixed-grain query.
  • Raw typed values; avoid FORMAT(), UI labels, SQL syntax, and friendly-name-only projections in query output.
  • Leave BLANKs and visual gap-filling to the app/spec unless the model semantics require otherwise.

Core query pattern

DEFINE
  VAR _CategoryFilter = TREATAS({"Bikes", "Accessories"}, 'Product'[Category])
  VAR _YearFilter = FILTER(ALL('Calendar'[Year]), 'Calendar'[Year] >= 2024)

EVALUATE
  SUMMARIZECOLUMNS(
    'Calendar'[Year],
    'Product'[Category],
    _CategoryFilter,
    _YearFilter,
    "Revenue", [Total Revenue],
    "Margin %", [Margin %]
  )
ORDER BY 'Calendar'[Year], [Revenue] DESC

For TopN, time intelligence, BLANK behavior, highlight overlays, filter fragments, and detailed anti-pattern corrections, open the references only when that problem appears.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.