SAP Knowledge Base Article - Public

2712387 - SAP Analytics Cloud (SAC) - Dynamic references in LastPeriods


  • Creating a formula that contains LastPeriods results in error if the period is defined dynamically.
  • For example: LOOKUP([AMT], [d/Time] = LastPeriods ("Month",[NUM]))
  • For such a formula to work, the number must be defined within the formula.
  • It doesn't work if it references a measure.
  • Even if the measure contains numbers, SAP Analytics Cloud does not accept the formula and provides an error message:   "Formula could not be computed: Function LastPeriods expects parameter 2 of type "Number", but receives "Number"; try using the expected parameter type. Try rewriting the formula."


  • SAP Analytics Cloud 2018.18

Reproducing the Issue

  1. Create a new model.
  2. Create an account dimension.
  3. Create three items: AMT, AMT_MEAN, and NUM.
  4. Define "NUM" with the following formula: MOD(DECFLOAT([d/Time].[p/CALMONTH]),100)
  5. Define "AMT_MEAN" with the following formula: LOOKUP([AMT],[d/Time] = LastPeriods ("Month",[NUM]))


  • The “LastPeriods“ formula is not designed to work with dynamic inputs.
  • Only constant numbers can be used in the formula.


This is a feature enhancement and may be considered in a future release

See Also

Your feedback is important to help us improve our knowledge base.


SAP Cloud for Planning, sc4p, c4p, cforp, cloudforplanning, EPM-ODS, Cloud for Analytics, Cloud4Analytics, CloudforAnalytics, Cloud 4 Planning, BOC, SAPBusinessObjectsCloud, BusinessObjectsCloud, BOBJcloud, BOCloud., SAC, SAP AC, Cloud-Analytics, CloudAnalytics, SAPCloudAnalytics , KBA , LOD-ANA , SAP Analytics Cloud (SAC) , LOD-ANA-BI , Business Intelligence Functionality, Analytic Models , LOD-ANA-PL , Planning , LOD-ANA-BR , SAC Boardroom , LOD-ANA-PR , SAC Predictive , Problem


SAP Analytics Cloud 1.0