/pigment:using-formula-functionsfrom Pigment
Quick reference for Pigment formula built-in functions covering logical, numeric, text, date, and aggregation categories. Use when drafting or debugging Pigment formulas.
Ships in Pigment. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Pigment has its own proprietary formula language. These are NOT Excel/SQL/Python functions. Use only Pigment syntax.
Find the function below, then open the matching sub-file for full signatures, parameters, return types, gotchas, and examples. Match function name exactly (case-sensitive); pass parameters in documented order.
A AND B, NOT cond), not function calls| Function | Syntax |
|---|---|
| IF | IF(Cond, ValTrue [, ValFalse]) — 3rd arg optional (BLANK if omitted); both branches always evaluated |
| SWITCH | SWITCH(Expr, Case1, Res1 [, ...] [, Default]) — cases must be scalar |
| AND | cond1 AND cond2 — infix; BLANK propagates |
| OR | cond1 OR cond2 — infix; TRUE short-circuits BLANK |
| NOT | NOT cond — prefix; NOT(BLANK) ≠ TRUE |
| TRUE / FALSE | Bare constants; FALSE densifies |
| ISDEFINED | ISDEFINED(Val) → TRUE/BLANK — sparse |
| IFDEFINED | IFDEFINED(Block, IfDef [, IfBlank]) — sparse |
| IFBLANK | IFBLANK(Metric, FillVal) — fills blanks; constant fill densifies |
| ISBLANK | ISBLANK(Val) → TRUE/FALSE — densifies; avoid |
| ISNOTBLANK | ISNOTBLANK(Val) → TRUE/FALSE — densifies; avoid |
| ANYOF | ANYOF(BoolBlock) → scalar TRUE if any |
| ALLOF | ALLOF(BoolBlock) → scalar TRUE if all |
| IN | Block IN (Item1, Item2) or Block IN (lo : hi) — infix |
| Function | Syntax | Notes |
|---|---|---|
| ABS | ABS(N) | |
| SIGN | SIGN(N) | 1, 0, -1 |
| SQRT | SQRT(N) | Negative → BLANK |
| EXP | EXP(N) | e^N |
| LN | LN(N) | ≤0 → BLANK |
| LOG | LOG(N) | Base 10 only; negative → BLANK |
| SIN / COS | SIN(N) / COS(N) | Radians |
| MIN / MAX | MIN(V1, V2, ...) | Also works with Date |
| MOD | MOD(N, Div) | Remainder |
| QUOTIENT | QUOTIENT(N, Div) | Integer part |
| POWER | POWER(N, P) | |
| ROUND | ROUND(N [, Digits]) | Nearest; 0–14 digits; out of range → BLANK |
| ROUNDUP | ROUNDUP(N [, Digits]) | Rounds up (away from zero) |
| ROUNDDOWN | ROUNDDOWN(N [, Digits]) | Rounds down (toward zero) |
| TRUNC | TRUNC(N [, KeptDigits]) | KeptDigits Integer only (not Metric); negative → BLANK |
| CEILING | CEILING(N) | Toward +∞; CEILING(-2.36) → -2 |
| FLOOR | FLOOR(N) | Toward -∞; FLOOR(-2.36) → -3 |
| CUMULATE | CUMULATE(N, Dim [, GroupDim] [, Agg]) | Running total; supports ON for custom order |
| DECUMULATE | DECUMULATE(N, Dim [, GroupDim]) | Inverse of CUMULATE |
| MOVINGSUM | MOVINGSUM(Input, WinSize [, EndOff] [, Dim]) | Blanks ignored; integer window faster |
| MOVINGAVERAGE | MOVINGAVERAGE(Input, WinSize [, EndOff] [, Dim]) | Blanks excluded from sum AND count |
| RANK | RANK(Block [, Group] [, Dir] [, Ties]) | Skip Group with "" / 0 / false |
| SPREAD | SPREAD(Block, RankDim, N [, StartIdx]) | Equal split (1/N), not proportional |
| Function | Syntax | Notes |
|---|---|---|
| TEXT | TEXT(Number) | Number → Text |
| VALUE / NUMBER | VALUE(Text) | Text → Number; invalid → BLANK |
| LEN | LEN(Text) | Character count |
| LEFT | LEFT(Text, Count) | Negative → BLANK; overflow → all |
| MID | MID(Text, Start, Count) | 1-based; position 0 → BLANK |
| RIGHT | RIGHT(Text, Count) | |
| LOWER / UPPER | LOWER(Text) / UPPER(Text) | |
| PROPER | PROPER(Text) | Capitalize after non-alpha chars |
| TRIM | TRIM(Text) | Strip + collapse spaces |
| CONTAINS | CONTAINS(Find, Search [, Start] [, CaseSens]) | Substring first, haystack second; default case insensitive |
| STARTSWITH | STARTSWITH(Prefix, Text [, CaseSens]) | |
| ENDSWITH | ENDSWITH(Suffix, Text [, CaseSens]) | |
| FIND | FIND(Find, Search [, Start] [, CaseSens]) | 1-based; not found → BLANK |
| SUBSTITUTE | SUBSTITUTE(Text, Old, New [, OccN]) | Case sensitive (only text fn that is) |
| & | text1 & text2 | Requires TEXT() for non-text operands |
| Function | Syntax | Notes |
|---|---|---|
| DATE | DATE(Y, M, D) | Returns Text, not Date |
| DATEVALUE | DATEVALUE(Text, Format) | Returns Date; English month names only |
| DAY / MONTH / YEAR | DAY(Date) etc. | Integer extraction |
| WEEKDAY | WEEKDAY(Date) | 0=Sun, 1=Mon, ..., 6=Sat |
| DAYS | DAYS(Start, End) | Difference (End − Start) |
| MONTHDIF | MONTHDIF(Start, End) | Month boundary crossings |
| EDATE | EDATE(Date [, MonthOff]) | Date ± N months |
| EOMONTH | EOMONTH(Date [, MonthOff]) | Last day of month |
| STARTOFMONTH | STARTOFMONTH(Date [, MonthOff]) | First day of month |
| INPERIOD | INPERIOD(Date, TimeDim) | TRUE/BLANK |
| DAYSINPERIOD | DAYSINPERIOD(TimeDim [, Start] [, End] [, WorkDays] [, Holidays]) | Integer; no Day dim; Start incl, End excl (+1 for inclusive) |
| PRORATA | PRORATA(TimeDim [, Start] [, End] [, WorkDays] [, Holidays]) | 0–1; Start incl, End excl (+1 for inclusive) |
| NETWORKDAYS | NETWORKDAYS(From, To [, WorkDays] [, Holidays]) | End excluded (+1 for inclusive); no weekend filter without WorkDays |
| MONTHTODATE | MONTHTODATE(Metric [, Agg]) | Resets each month |
| QUARTERTODATE | QUARTERTODATE(Metric [, Agg]) | Resets each quarter |
| YEARTODATE | YEARTODATE(Metric [, Agg]) | Resets each year |
| FILLFORWARD | FILLFORWARD(Expr, Dim [, ON]) | Non-iterative; densifies |
| Function | Syntax | Notes |
|---|---|---|
| ITEM | ITEM(Val, Dim.'UniqueProp') | Unique property only; faster |
| MATCH | MATCH(Val, Expr) | Any property (first match); case-sensitive |
| SHIFT | SHIFT(Block, Offset) | Returns Dimension item; out of range → BLANK |
| TIMEDIM | TIMEDIM(Date, TimeDim) | Date → Calendar element; fiscal-year aware |
All return scalar (no dimensions). For dimensional aggregation use modifiers.
| Function | Syntax | Input | Blanks |
|---|---|---|---|
| SUMOF | SUMOF(Block) | Number | Ignored |
| AVGOF | AVGOF(Block) | Number | Ignored |
| MINOF | MINOF(Block) | Number/Date | Ignored |
| MAXOF | MAXOF(Block) | Number/Date | Ignored |
| COUNTOF | COUNTOF(Block) | Any | Non-blank only |
| COUNTALLOF | COUNTALLOF(Block) | Any | All incl. blank |
| COUNTBLANKOF | COUNTBLANKOF(Block) | Any | Blank only |
| COUNTUNIQUEOF | COUNTUNIQUEOF(Block) | Any | Unique non-blank |
Parameter order differs from Excel. Rate is 1st (NPV/XNPV). Guess is 2nd (IRR/XIRR).
| Function | Syntax | Notes |
|---|---|---|
| NPV | NPV(Rate, CFs [, AllCells] [, RankDim]) | Periodic; excludes initial investment |
| XNPV | XNPV(Rate, CFs [, AllCells] [, RankDim] [, DaysUsed]) | Irregular dates; includes all |
| IRR | IRR(CFs [, Guess] [, AllCells] [, RankDim]) | Needs mixed-sign CFs |
| XIRR | XIRR(CFs [, Guess] [, AllCells] [, RankDim] [, DaysUsed]) | Irregular dates |
| Function | Syntax | Best for |
|---|---|---|
| FORECAST_ETS | FORECAST_ETS(Input, Season [, RankDim] [, α, β, γ]) | Trend + seasonality; if any α/β/γ given, all 3 required |
| FORECAST_LINEAR | FORECAST_LINEAR(Metric [, RankDim] [, AltMetric]) | Simple linear trend |
| SIMPLE_EXPONENTIAL_SMOOTHING | SIMPLE_EXPONENTIAL_SMOOTHING(Input [, RankDim [, α]]) | No trend, no seasonality |
| DOUBLE_EXPONENTIAL_SMOOTHING | DOUBLE_EXPONENTIAL_SMOOTHING(Input [, RankDim [, α, β]]) | Trend, no seasonality |
| SEASONAL_LINEAR_REGRESSION | SEASONAL_LINEAR_REGRESSION(Input, Season [, RankDim]) | Seasonality with trend |
| STANDARD_NORMAL_DISTRIBUTION | STANDARD_NORMAL_DISTRIBUTION(z) | PDF (z-score) |
| STANDARD_NORMAL_DISTRIBUTION_CUMULATIVE | STANDARD_NORMAL_DISTRIBUTION_CUMULATIVE(z) | CDF |
ACCESSRIGHTS(ReadBoolean, WriteBoolean) — use BLANK (not FALSE) for deny to preserve sparsity. See skill:securing-with-access-rights for full patterns and notes.
Mandatory pattern — always wrap in IFDEFINED('Users roles', ...):
IFDEFINED('Users roles', ACCESSRIGHTS(ISDEFINED(User), User.'Role' = SET_Admin_Role))
| Function | Syntax | Notes |
|---|---|---|
| PREVIOUS | PREVIOUS(IterDim [, Offset]) | Single-block self-reference; max 10k items |
| PREVIOUSOF | PREVIOUSOF(Metric [, Offset]) | Multi-block; requires cycle setup first |
| PREVIOUSBASE | Deprecated (Q2 2026) | Use PREVIOUSOF |
Only use for true circular dependencies. For time shifts use [SELECT: Dim-N].
functions_finance.md (opens in a new tab)functions_forecasting.md (opens in a new tab)functions_iterative_calculation.md (opens in a new tab)functions_logical.md (opens in a new tab)functions_lookup_and_aggregation.md (opens in a new tab)functions_numeric.md (opens in a new tab)functions_text.md (opens in a new tab)functions_time_and_date.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
39 skills in this plugin
/aggregating-view-dataExecution skill. Use when a View needs totals or subtotals, when a value must roll up with something other than Sum (average, min, max, count, last), when a snapshot metric adds up across time instead of holding, or when a ratio, percentage, margin, growth or variance metric is added to a Table View or shows a wrong total (e.g. a row for margin as a percent of revenue). Covers metric default aggregators, pivot versus hidden-dimension aggregation, the aggregator reference per value type, and Advanced Aggregators on Table Views./architecting-multi-application-solutionsPlanning skill. Use when deciding how to split work across Pigment applications, designing Hub-and-spoke data flows, or planning Test & Deploy across environments./auditing-a-pigment-applicationExecution skill. Use when auditing, reviewing, or health-checking a Pigment application. Covers the structured audit checklist, severity classification, and output format. Also triggers on requests to clean up, find unused blocks, assess model quality, or find what is wrong with an application./building-a-full-applicationPlanning skill. Use when building a complete Pigment application from scratch or when the request spans multiple modeling phases. This skill, together with any other planning skill the request calls for, is sufficient to produce the full architecture spec; do not load execution skills until the spec is approved and you begin building blocks./building-pigment-framesUse this skill whenever you're building, updating, or troubleshooting a Pigment Frame — a full-page, custom-coded visualisation (JavaScript, canvas, or inline SVG) that reads Pigment data through the PigmentSDK. Reach for it any time a native View (Grid, Chart, KPI) or Board can't produce what's being asked for - a bespoke chart, a custom canvas drawing, an interactive widget, or a standalone page in the left navigation that behaves like a small app. Also use it if a Frame you've already built shows up blank or broken and needs debugging./building-versions-and-planning-cyclesExecution skill. Use when implementing versions, planning cycles, or actuals vs forecast separation, and whenever realized data is extended into a plan or budget — loading actuals then planning the remaining periods, forecasting forward from actuals, Actual/Budget/Plan layering, plan vs actual variance — even when the request never uses the word version. Covers Version Dimensions, Switchover patterns, Actual/Forecast layering, Native Scenarios, and Snapshots.npx claudepluginhub gopigment/ai-plugins --plugin pigmentOther plugins' skills for the same job