iOfficeAI/OfficeCLI · error · ArgumentException
showDataAs '{showAs}' is not yet supported by the renderer (
Error message
showDataAs '{showAs}' is not yet supported by the renderer (would silently return raw aggregate). Supported: normal, percent_of_total, percent_of_row, percent_of_col, running_total. What it means
ParseShowDataAs accepts difference / diff / percent_diff / percentdiff / index tokens but immediately throws, because while the OOXML ShowDataAsValues enum defines them, the in-process renderer (ApplyShowDataAs1x1) has no matrix transformation for them — accepting them would silently render the raw aggregate and mislead the user. The message names the supported set so the user can pick a working alternative.
Source
Thrown at src/officecli/Core/PivotTableHelper.Parse.cs:458
}
private static ShowDataAsValues? ParseShowDataAs(string showAs)
{
return showAs.ToLowerInvariant() switch
{
"" or "normal" => null,
"percent_of_total" or "percentoftotal" or "percent" => ShowDataAsValues.PercentOfTotal,
"percent_of_row" or "percentofrow" => ShowDataAsValues.PercentOfRaw,
"percent_of_col" or "percent_of_column" or "percentofcol" or "percentofcolumn" => ShowDataAsValues.PercentOfColumn,
"running_total" or "runningtotal" or "runtotal" => ShowDataAsValues.RunTotal,
// CONSISTENCY(strict-enums): difference / percent_diff / index are
// accepted by the OOXML ShowDataAsValues enum, but ApplyShowDataAs1x1
// has no matrix transformation for them, so rendered cells would
// silently equal the raw aggregate. Reject up front until a proper
// renderer exists, mirroring the invalid-sort / invalid-aggregate
// policy from Round 1.
"difference" or "diff" or "percent_diff" or "percentdiff" or "index" =>
throw new ArgumentException(
$"showDataAs '{showAs}' is not yet supported by the renderer " +
"(would silently return raw aggregate). Supported: normal, " +
"percent_of_total, percent_of_row, percent_of_col, running_total."),
// CONSISTENCY(strict-enums): unknown showAs tokens are rejected
// up front so users see typos at Add/Set time, not on render.
_ => throw new ArgumentException(
$"invalid showDataAs: '{showAs}'. Valid: normal, percent_of_total, percent_of_row, " +
"percent_of_col, running_total"),
};
}
// R11-2: Right-to-left value-spec parser support. Token recognizers
// mirror the cases ParseSubtotal / ParseShowDataAs accept (lowercase
// canonical only — we lowercase the token before calling). Keep these
// in sync if new aggregates / showAs tokens are added downstream.
private static bool IsKnownAggregateToken(string token) => token switch
{
"sum" or "count" or "countnums" or "countnum" or "average" or "avg" orView on GitHub (pinned to 1ced45e900)
Solutions
- Use a supported showAs: normal, percent_of_total, percent_of_row, percent_of_col, or running_total
- Compute the difference/percent_diff transform upstream and feed the resulting values as a regular sum field
- Track the feature request — these tokens are deliberately gated until a proper renderer exists
Example fix
// before values="Sales:sum:percent_diff" // after (compute upstream, or pick a supported showAs) values="Sales:sum:percent_of_total"
Defensive patterns
Strategy: validation
Validate before calling
var unsupported = new[] { "difference", "diff", "percent_diff", "percentdiff", "index" };
if (unsupported.Contains(showAs.ToLowerInvariant()))
throw new InvalidOperationException($"showDataAs '{showAs}' has no renderer; precompute the transform instead"); Type guard
static readonly HashSet<string> SupportedShowAs = new(StringComparer.OrdinalIgnoreCase)
{ "normal", "percent_of_total", "percent_of_row", "percent_of_col", "running_total" };
static bool IsSupportedShowAs(string s) => SupportedShowAs.Contains(s); Try / catch
try { BuildPivot(props); }
catch (ArgumentException ex) when (ex.Message.Contains("not yet supported by the renderer"))
{ /* switch to a supported showAs or precompute upstream */ } Prevention
- Use only the supported showAs family
- Compute difference/percent_diff/index transforms upstream and feed plain sums
- Track the renderer roadmap before relying on these tokens
When it happens
Trigger: values=Sales:sum:difference; values=Sales:sum:percent_diff; values=Sales:sum:index; copying a showDataAs token from an Excel-generated file that uses one of these unsupported modes.
Common situations: User wants period-over-period or indexed calculations and reaches for the OOXML token without realising the renderer only supports percent/running-total family; replaying a spec exported from native Excel that exercises these modes.
Related errors
- invalid showDataAs: '{showAs}'. Valid: normal, percent_of_to
- invalid aggregate: '{func}'. Valid: sum, count, countNums, a
- calculatedField requires a non-empty name
- calculatedField '{name}' requires a non-empty formula
- calculatedField '{name}' collides with an existing field nam
AI-assisted analysis of iOfficeAI/OfficeCLI@1ced45e900 (2026-08-13).
Data as JSON: /api/errors/55f655c605f9cc01.
Report an issue: GitHub.