Skip to main content

Hi Pigment Community! I’m trying to create a Metric wherein if Actual Months, it will get the Actuals Details, while if Forecast Months (starting January 2025) it will get the average of January to September 2024 Actuals. Then for October to December 2024 it should be zero or blank. What is the best formula for this?

For context:

  • January to September 2024 - from my Actuals metrics
  • October to December 2024 - zero
  • January 2025 onwards - average of January to September 2024
  • I also set up a boolean for the months of 2025

This is my initial formula:
IF(Actual?, ' Actuals' , (IF('Month.’2025’,…. I should put here the formula for the average, then if it is not 2025 it should be zero

Thank you in advance for your help!
 

Hey Suzzy, 

I would create a few support metrics to make the solution easier to maintain. Here are the metrics that I suggest you create:

  • MET_INP_Start_of_Forecast_Calculation
    • No dimension (although if you need something version specific then I would also add version)
    • Type is the month dimension
    • Value would be Jan 25
  • MET_CALC_Start_of_Forecast
    • Month dimension (although if you need something version specific then I would also add version)
    • Type is boolean
    • Formula: IF(Month.’Start Date’ >= MET_INP_Start_of_Forecast_Calculation.’Start Date’, TRUE)
    • Output: this will give you boolean values for all months that are forecast months
  • I assume that your “Actual?” metric already returns a boolean value for the actual months.
  • Your final formula could then look something like this:
    • IF(“Actual?”, ‘Actuals’, IF(MET_CALC_Start_of_Forecast, ‘Forecast_Values’))
    • This would return a blank value for October to December

Let me know if you need help with the average calculations. 

Also a couple things I suggest to keep in mind:

  • Avoid hard coding values into formulas. In my opinion it is better to create a metric where you for example input the value for beginning of forecast months as you can use a formula to create this value and you will not need to manually update formulas in the future
  • Keep in mind how different versions may behave 

Reply