# Dax Lib

> Use when about to write a DAX UDF, to check whether one is already published on DAX Lib (daxlib.org) — moving averages, format strings, SVG visuals, KPI/variance, RFM/ABC classification, unit conversion, model metadata, sample data. Offline index — what exists, who wrote it, where to get it. Triggers on "is there a UDF for", "existing DAX UDF", "daxlib", "DAX Lib package".

- Skill: `csalcedodatabi/dax-lib` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx get-skill add csalcedodatabi/dax-lib`
- Raw SKILL.md: https://api.skillmd.com/api/skills/csalcedodatabi/dax-lib/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: CSalcedoDataBI (https://skillmd.com/u/csalcedodatabi)
- Updated: 2026-11-18
- Page: https://skillmd.com/skills/csalcedodatabi/dax-lib

---


# DAX Lib — index of published DAX UDFs

**Before authoring a UDF from scratch, check here — someone may have already shipped it.**

This is an **offline index** of [DAX Lib](https://daxlib.org), the package registry for DAX
user-defined functions. It tells you what exists, who wrote it and what it does, so the agent
can answer "does this already exist?" without a network round trip.

**It does not carry the DAX code.** The code lives at the registry, which is where it stays
current. See [`NOTICE`](./NOTICE.md).

Pairs with **`dax-lib-install`** (actually install what this index found),
**`dax-udf-authoring`** (how to write your own when none fits), and
**`dax-reference`** (what the built-in functions do).

## Files

| File | Use |
|---|---|
| [`catalog.md`](./catalog.md) | Human index — one row per package: id, latest version, author, functions, description. **Scan this first.** |
| [`catalog.json`](./catalog.json) | Machine index — every version, with `functions[]`, `tags[]`, `isLatest`, `url`. Use for keyword/tag search. |
| [`refresh-daxlib.ps1`](https://github.com/CSalcedoDataBI/dax-for-agents/blob/main/scripts/dax-lib/refresh-daxlib.ps1) | Rebuilds the index from `daxlib/daxlib`. Maintainer tool: it lives in the repository, not in the plugin. |

## Workflow

1. **Identify the need** — "trailing moving average", "waterfall SVG", "RFM segmentation".
2. **Search the index.** Grep `catalog.md`, or query `catalog.json` by `tags` / `functions` /
   `description`. Tags are coarse (`DAX,UDF,SVG,TIMESERIES,…`) — match on description and
   function names too.
3. **Report what you found**: package id, author, the function signature from `functions[]`,
   and the `url` to its source. Say plainly that the code has to come from the registry.
4. **If the user wants it installed**, not just documented, route to
   **`dax-lib-install`** — do not fetch, paste, or install the code yourself.
   That skill owns the fetch, the license check, the install, and the attribution.
5. **If nothing fits**, say so and route to `dax-udf-authoring`.

## Example

```
Need: trailing N-period moving average over a dynamic date column.
catalog.json → id "TimeSeries.MovingAverage" (latest 0.1.1), tags TIMESERIES,
  functions: Simple, Weighted, LinearWeighted, Exponential, DoubleExponential,
             Triangular, Geometric
url → https://github.com/daxlib/daxlib/tree/main/packages/t/timeseries.movingaverage
```

`TimeSeries.MovingAverage.Simple( dateColumn, timeSeriesTable, lookbackPeriods, expression )`
is built on native `WINDOW` (see **`dax-window-functions`**), which is generally cheaper than a
hand-rolled `TOPN + CALCULATETABLE`. It needs a fixed date column, so it does not fit a model
whose grain is a dynamic period axis.

## Refresh

A maintainer step, run from a clone of
[the repository](https://github.com/CSalcedoDataBI/dax-for-agents) — the script is not part
of the installed plugin: `scripts/dax-lib/refresh-daxlib.ps1`.

It shallow-clones `daxlib/daxlib@main`, reads each package's `manifest.daxlib`, parses the function
names out of its `functions.tmdl`, and rewrites `catalog.json` + `catalog.md` stamped with the
upstream commit. **It keeps no `.tmdl` file.**

**Why a script and not WebFetch:** daxlib.org is a JavaScript SPA — a plain HTTP GET returns the
empty app shell. GitHub is the source of truth.

## Notes

- The index is a snapshot; the registry is live. Check `source` in `catalog.json` for how old it
  is, and prefer the registry when a version matters.
- All versions are indexed (`isLatest` flags the newest per package). Prefer the latest unless
  reproducing a specific one.
- Some `manifest.daxlib` files still point their `$schema` at the old `sql-bi/daxlib` path — the
  repo was renamed to `daxlib/daxlib`. Harmless.
- **Licensing varies per author.** The upstream repo is MIT, but individual packages declare no
  license of their own — check the package before reusing its code in a product.

