Symptom
- Data action script issue with year comparison in Sap Analytics Cloud
Environment
- Sap Analytics Cloud
Reproducing the Issue
- Access the SAP Analytics Cloud tenant.
- Use the Data Action
- Execute the script containing the calculations for TEMP DataSource and reclassification of assets.
- 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
- Update the dimension to include a date format.
- 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
- 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
SAP Knowledge Base Article - Public