SAP Knowledge Base Article - Public

3653061 - Resolution for data action script issue with year comparison in Sap Analytics Cloud

Symptom

  • Data action script issue with year comparison in Sap Analytics Cloud

Environment

  • Sap Analytics Cloud

Reproducing the Issue

  1. Access the SAP Analytics Cloud tenant.
  2. Use the Data Action 
  3. Execute the script containing the calculations for TEMP DataSource and reclassification of assets.
  4. Observe an error in the bold area of the script.

Cause

The issue arises due to the inability of the script to correctly compare the year property in the dimension with the date dimension.

Resolution

  1. Update the dimension to include a date format.
  2. Modify the data action script to use the DATEDIFF function for year comparison. Example:

IF DATEDIFF([d/Date], [d/PIL_FI_IFP_PLANJAHR].[p/Current_Year_Date], "YEAR", "Floor") <= 0 AND

DATEDIFF([d/Date], [d/PIL_FI_IFP_PLANJAHR].[p/Current_Year_Date], "YEAR", "Floor") >= -2 THEN

  1. For cases where the year is specified as an integer in the dimension, use a calculated dimension with the formula:

SUBSTRING([d/Date].[p/YEAR], 0, 4)

This extracts the year for comparison with the integer property.

See Also

Keywords

data action script, year comparison, sap analytics cloud, dimension update, DATEDIFF function, TEMP DataSource, reclassification of assets, integer year property, calculated dimension, SUBSTRING function. , KBA , LOD-ANA-PL-DA , Data Actions , Problem

Product

SAP Analytics Cloud all versions