Symptom
- Creating a calculated column in a Story Report using ADDMONTHTODATE(Date, Number) returns a validation error.
- Error message: "Formula could not be computed: Function 'AddMonthToDate' expects parameter 2 of type 'Number', but receives 'Number'; try using the expected parameter type. Please complete or rewrite the formula."
Environment
- Query Designer - Filter, Calculated Column, Params
Reproducing the Issue
- Navigate to Report Center and create or edit a Story Report.
- Create a calculated column with: ADDMONTHTODATE(Date Field, Numeric Field).
- Validate the formula
- Observe the validation error indicating a datatype mismatch for parameter 2.
Cause
ADDMONTHTODATE in Story calculated columns requires the second parameter to be of a strict Integer subtype, not a generic decimal Number type.
The numeric field [Probationary Report Number], while appearing as a Number, is internally stored as a decimal/float numeric type within the model. This does not satisfy the Integer subtype expectation of ADDMONTHTODATE.
Resolution
- Edit the calculated column formula to explicitly cast the second parameter to an integer.
- Use the pattern: ADDMONTHTODATE([Date field], TOINTEGER(TOTEXT([Number field]))).
- Validate the formula in Query Designer and run Preview to confirm the calculation completes without errors.
See Also
Keywords
Story Reports, Query Designer, calculated column, AddMonthToDate, ADDMONTHTODATE, validation error, datatype mismatch, number parameter, integer cast, TOINTEGER, TOTEXT, date function, TONUMBER , KBA , LOD-SF-ANA-SAC-QDS , Query Designer - Filter, Calculated Column, Params , Problem
SAP Knowledge Base Article - Public