---
title: "Fixing WQL \"Empty Required Parm Moment_Parm\" with SUM()"
description: "Understand why WQL throws S24 \"Empty Required Parm Moment_Parm (21$9232)\" when aggregating currency fields on bonusAndOne_TimePayments and how to aggregate…"
url: https://kiweely.com/guides/wql-empty-required-parm-moment-parm-sum
---

# Fixing WQL Error “Empty Required Parm Moment\_Parm” with SUM()

Combining SUM() and GROUP BY on currency fields in compensation data sources like bonusAndOne\_TimePayments can trigger S24 “Empty Required Parm Moment\_Parm (21$9232)”. Learn how currency moment evaluation works in WQL and how to structure or fall back when aggregating payment amounts.

-   **Checked** against Workday on November 6
-   Applies to **Workday Query Language**
-   3 min read
-   Published November 6
-   By Kiweely

## Why `SUM()` on `bonusAndOne_TimePayments` Throws `Empty Required Parm Moment_Parm`

When aggregating currency fields with `SUM()` and grouping by a dimension on compensation data sources such as `bonusAndOne_TimePayments`, Workday Query Language (WQL) can fail with HTTP status `500` or `400` and error code `S24`:

json

```
{
  "caseId": "c53ea85a-8d16-44c1-a504-9406bec721d3",
  "code": "S24",
  "error": "Empty Required Parm Moment_Parm (21$9232)\nXpressO Call Stack Trace=\n86$568030:1$35847, 86$701696:866$6, 86$714079:866$6, 86$554745:866$6, 34$33600, 86$1:866$6"
}
```

This error surfaces on queries that aggregate a currency field (`paymentAmount`) alongside an instance field (`one_TimePaymentPlan`) over a date-bounded data source:

sql

```
SELECT SUM(paymentAmount) AS paymentAmount, one_TimePaymentPlan AS paymentType
FROM bonusAndOne_TimePayments (startDate = '2026-01-01', endDate = '2026-12-31')
WHERE employee IN (3aa5550b7fe348b98d7b5741afc65534)
  AND one_TimePaymentPlan IN (
    'bb44c6e34f744f4b84004dc53e33a394',
    '40e7344f49b301c2ae97c30bd23d8604',
    'e005b0c2aea7460a9c71ab65e9918212'
  )
GROUP BY one_TimePaymentPlan
```

In Workday’s underlying reporting engine, `paymentAmount` is a `Currency` field rather than a plain `Numeric` scalar. Each row carries both a numeric amount and a currency code (`{"currency": "USD", "value": "371.06"}`). When WQL summarizes currency values across grouped instances, the internal XpressO aggregation routine evaluates currency context as of a specific effective moment (`Moment_Parm`, internal identifier `21$9232`).

When the data source uses range prompts (`startDate` and `endDate`) rather than a single effective date parameter, an internal WQL regression caused the grouped currency aggregator to invoke the currency conversion routine with an unpopulated `Moment_Parm`. Removing `SUM(paymentAmount)` or removing the grouped `one_TimePaymentPlan` dimension bypassed the grouped currency aggregation path, which is why the ungrouped query continued to work while the grouped `SUM()` failed.

## Why Arithmetic Calculated Fields Do Not Bypass `Moment_Parm`

A common troubleshooting instinct when `SUM()` fails on a currency field is to wrap `paymentAmount` inside an **Arithmetic Calculation** calculated field (`paymentAmount * 1`, aliased as `cf_ac_paymentAmountAsNumber`) and sum the calculated field instead:

sql

```
SELECT SUM(cf_ac_paymentAmountAsNumber), one_TimePaymentPlan
FROM bonusAndOne_TimePayments (startDate = '2026-01-01', endDate = '2026-12-31')
WHERE employee IN (3aa5550b7fe348b98d7b5741afc65534)
  AND one_TimePaymentPlan IN (
    40e7344f49b301c2ae97c30bd23d8604,
    e005b0c2aea7460a9c71ab65e9918212,
    bb44c6e34f744f4b84004dc53e33a394
  )
GROUP BY one_TimePaymentPlan
```

This still returns `Empty Required Parm Moment_Parm (21$9232)`. Even when an Arithmetic Calculation outputs a numeric type, evaluating `paymentAmount` inside the calculation tree still triggers the underlying currency field getter on the `One-Time Payment` business object. Similarly, building the exact same summary in a custom report and running **Convert Report to WQL** produces a WQL statement that includes `GROUP BY one_TimePaymentPlan, paymentAmount`, which fails on the same internal parameter check.

Note also that WQL’s `GROUP BY` clause explicitly prohibits grouping by currency fields directly. If **Convert Report to WQL** appends a currency field such as `paymentAmount` to the `GROUP BY` list, remove `paymentAmount` from `GROUP BY` so only the dimension field (`one_TimePaymentPlan`) remains.

## How to Structure the Query and Aggregate Resiliently

Workday patched the underlying WQL `Moment_Parm` defect for `bonusAndOne_TimePayments` so that standard `SUM(paymentAmount)` queries return grouped currency objects cleanly:

json

```
{
  "data": [
    {
      "paymentAmount": {
        "currency": "USD",
        "value": "371.06"
      },
      "paymentType": {
        "descriptor": "Relocation",
        "id": "40e7344f49b301c2ae97c30bd23d8604"
      }
    },
    {
      "paymentAmount": {
        "currency": "USD",
        "value": "3403.92"
      },
      "paymentType": {
        "descriptor": "Retention Incentive",
        "id": "e005b0c2aea7460a9c71ab65e9918212"
      }
    },
    {
      "paymentAmount": {
        "currency": "USD",
        "value": "11477.83"
      },
      "paymentType": {
        "descriptor": "Spot Bonus",
        "id": "bb44c6e34f744f4b84004dc53e33a394"
      }
    }
  ],
  "total": 3
}
```

However, if you encounter `Empty Required Parm Moment_Parm (21$9232)` on another compensation, payroll, or multi-currency data source where WQL’s internal aggregator cannot resolve a currency moment, you have two reliable options.

### Option 1: Pass an Explicit Effective Date When the Data Source Supports It

Inspect the data source metadata via `GET /wql/v1/dataSources/{ID}` to check whether it accepts `effectiveAsOfDate` or a moment prompt in the `FROM` or `PARAMETERS` clause. Supplying an explicit `effectiveAsOfDate` satisfies the internal moment requirement on data sources that expose it:

sql

```
SELECT SUM(paymentAmount) AS paymentAmount, one_TimePaymentPlan AS paymentType
FROM bonusAndOne_TimePayments (
  startDate = '2026-01-01',
  endDate = '2026-12-31'
)
WHERE employee IN (3aa5550b7fe348b98d7b5741afc65534)
  AND paymentAmount IS NOT EMPTY
GROUP BY one_TimePaymentPlan
```

Always include `AND paymentAmount IS NOT EMPTY` when summing optional currency fields so null entries do not interfere with currency code resolution across grouped rows.

### Option 2: Fetch Ungrouped Payment Rows and Aggregate in PMD or Orchestrate

Because a single worker or small cohort typically has only a handful of one-time payment events in a calendar year, fetching the individual rows without `SUM()` or `GROUP BY` completely avoids WQL’s grouped currency aggregation path:

sql

```
SELECT paymentAmount, one_TimePaymentPlan AS paymentType, paymentDate
FROM bonusAndOne_TimePayments (startDate = '2026-01-01', endDate = '2026-12-31')
WHERE employee IN (3aa5550b7fe348b98d7b5741afc65534)
  AND one_TimePaymentPlan IN (
    'bb44c6e34f744f4b84004dc53e33a394',
    '40e7344f49b301c2ae97c30bd23d8604',
    'e005b0c2aea7460a9c71ab65e9918212'
  )
```

In a PMD script, you can then group and sum `paymentAmount.value` by `paymentType.id` while preserving the currency code:

javascript

```
var rows = getOneTimePayments.data ?? [];
var totalsByPlan = {:};

for (var row : rows) {
  if (!empty row.paymentAmount && !empty row.paymentType) {
    var planId = row.paymentType.id;
    var amount = number:convertStringToDecimal(row.paymentAmount.value);
    if (empty totalsByPlan[planId]) {
      totalsByPlan[planId] = {
        "id": planId,
        "descriptor": row.paymentType.descriptor,
        "currency": row.paymentAmount.currency,
        "total": amount
      };
    } else {
      totalsByPlan[planId].total = totalsByPlan[planId].total + amount;
    }
  }
}
```

## How to Verify in the Tenant

1.  Open the **View WQL Query Result** task in your Workday tenant.
2.  Paste the ungrouped `SELECT paymentAmount, one_TimePaymentPlan` query first and confirm that rows return with valid `currency` and `value` pairs.
3.  Add `SUM(paymentAmount)` and `GROUP BY one_TimePaymentPlan` (ensuring `paymentAmount` itself is not listed in the `GROUP BY` clause) and run the query again.
4.  If the tenant returns `S24` with `Empty Required Parm Moment_Parm (21$9232)`, check `GET /wql/v1/dataSources/{ID}` in **REST API Explorer** for required or optional date/moment parameters, or switch the orchestration/PMD endpoint to the ungrouped query and sum the numeric values in your application logic.

## Sources checked

-   [WQL Reference: SELECT](https://developer.workday.com/documentation/GUID-85db8d16-4698-4dea-bef2-23223739c8e6-enHYPHENus)
-   [WQL Reference: FROM](https://developer.workday.com/documentation/GUID-608ff22c-1931-4c40-9a95-6bd0751133fe-enHYPHENus)
-   [WQL Reference: GROUP BY](https://developer.workday.com/documentation/GUID-f0284119-5c5b-407a-9581-672164ad9f18-enHYPHENus)
-   [Concept: Currency Field Display](https://doc.workday.com/admin-guide/en-us/reporting-and-analytics/custom-reports-and-analytics/fields-and-prompts/dan1370796985362.html)

## Related guides

[All guides](https://kiweely.com/guides)

-   [### Fixing WQL Error 804 on GROUP BY and Related Business Object Aggregation Limits Grouping a large transactional data source like allActiveAndTerminatedWorkers to populate dropdowns can fail with Error 804 in implementation tenants, while selecting RBO subfields with { } alongside COUNT() or GROUP BY fails validation. Learn the exact WQL grouping rules and solutions.](https://kiweely.com/guides/wql-group-by-error-804-rbo-aggregation-limits)
-   [### Fixing WQL HTTP 400 “Parms are required for the fields or data source in the query” A WQL query returns HTTP 400 “Parms are required for the fields or data source in the query. Provide a value for the prompt” when a data source filter or calculated field requires a runtime prompt parameter. Learn how to isolate prompted cf\_ fields and pass values via PARAMETERS or FROM.](https://kiweely.com/guides/wql-400-parms-are-required-for-fields-or-data-source)
-   [### What is Workday Query Language (WQL), and how do you write and run a query? Workday Query Language (WQL) is Workday’s SQL-like language for reading data from data sources and fields instead of reports. You need the Workday Query Language domain in the System functional area; an external caller also needs an API client with System scope.](https://kiweely.com/guides/workday-wql)
-   [### Why does my Workday WQL query fail? The exact error messages and how to fix each one Workday has no WQL message worded ‘instance set invalid for prompt’. A rejected prompt value returns ‘Invalid Parameter Values for parameter’ or ‘does not meet the restrictions defined for this field’. This page quotes each common error as Workday returned it, with the fix.](https://kiweely.com/guides/wql-error-messages)

### More guides on WQL

[All 31 guides](https://kiweely.com/guides#wql)

-   [Fixing WQL “Cannot construct instance source on grouped results” with COUNT(DISTINCT)](https://kiweely.com/guides/wql-count-distinct-with-where-on-rbo-filter)
-   [Why WHERE fieldA = fieldB Throws “Invalid Where Clause” in WQL](https://kiweely.com/guides/wql-compare-two-fields-where-clause-invalid)
-   [Filtering Empty Related Business Objects in WQL and Guarding Omitted RBO Keys in PMD](https://kiweely.com/guides/wql-check-rbo-empty-missing-json-keys-pmd)
-   [Fixing WQL “Specify a valid report field” and HTTP 500 Errors When an ISU Queries Calculated Fields](https://kiweely.com/guides/wql-calculated-field-isu-specify-valid-report-field-500)
-   [Why WQL AVG() Rounds to Whole Numbers and How to Handle Conditional Logic Without CASE](https://kiweely.com/guides/wql-avg-integer-rounding-conditional-logic-without-case)
-   [WQL 500-Instance Related Business Object Limit and Large IN (...) Filter Limits](https://kiweely.com/guides/wql-500-rbo-instances-per-row-large-in-filter-limits)
-   [Custom Agent Actions that call Workday SOAP, REST and WQL](https://kiweely.com/guides/workday-custom-agent-actions-soap-rest-wql)
-   [Running WQL in Orchestrate as an integration system user: the security it needs](https://kiweely.com/guides/workday-orchestrate-wql-as-isu)

### From the blog on WQL

[All posts](https://kiweely.com/blog)

-   [What happens after ChatGPT writes your WQL query](https://kiweely.com/blog/after-chatgpt-writes-your-wql)
-   [Answering Executive Span-of-Control and Headcount Questions Live from Workday](https://kiweely.com/blog/executive-org-span-of-control-attrition-questions-live-workday)
-   [Build vs. Buy a Workday MCP Server: OAuth 2.1, SOAP, WQL, and Twice-Yearly Releases](https://kiweely.com/blog/build-vs-buy-workday-mcp-server-engineering-cost)

## Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

[Start for free](https://kiweely.com/download) [See how it works](https://kiweely.com/vine/how-it-works)

## Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.
