Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Bonjour/Hello (English version below),
J'ai créé le brouillon ci-joint pour avoir un cas concret mais voilà le problème :
Chaque mois, mon service Marketing m'envoie des prévisions de vente pour les 6 prochains mois.
En mai 2022, j'ai reçu les prévisions de mai à octobre 2022. Ainsi de suite jusqu'en août.
On a besoin de conserver un historique des prévisions reçues pour les comparer entre elles et avec les ventes réelles. Par conséquent, j'ai une dimension MonthOfForecast qui correspond au mois où j'ai reçu leurs prévisions.
Les ventes réelles sont connues de avril à juillet 2022.
L'objectif :
Si je sélectionne MonthOfForecast = 05/2022 alors je dois pouvoir voir les ventes réelles d'avant mai 2022 ainsi que les 6 mois de prévisions reçus en mai 2022.
Si je sélectionne MonthOfForecast = 07/2022 alors je dois pouvoir voir les ventes réelles d'avant juillet 2022 ainsi que les 6 mois de prévisions réçus en juillet 2022.
Comment puis-je faire ?
Merci.
---------------------
Please see the template attached but here is the idea:
Each month, my Marketing department send sales data for the next 6 months. During May 2022, I received their forecast from May to October 2022. The same applies until August.
We need to keep an history of theirs forecasts to be able to compare them later and with the actual sales too. Consequently, I have a dimension called MonthOfForecast which represents the month when I received theirs forecasts.
The actual sales are available from April to July 2022.
Purpose:
If I select MonthOfForecast = 05/2022 then I should be able to see the actual sales before May 2022 and the forecast of the next 6 months that I received in May 2022.
How can I do that?
Thank you.
My solution:
ForecastCountMonth:
LOAD
Distinct Date(MonthOfForecast, 'MM/YYYY') as MonthOfForecast
Resident Forecast;
LET vNbForecastMonth = NoOfRows('ForecastCountMonth');
TRACE $(vNbForecastMonth) <= Number of MonthOfForecast;
Merge:
LOAD
Country,
Month,
MonthOfForecast,
ForecastSales as SalesAmount,
Autonumber(Country & ' - ' & Date(Month, 'MM/YYYY')) as %KEY,
Country & ' - ' & Date(Month, 'MM/YYYY') as CountryMonth,
'FORECAST' as %DATASOURCE
Resident Forecast;
DROP Table Forecast;
FOR i = 1 to $(vNbForecastMonth)
LET vCivilMonthYear = peek('MonthOfForecast', $(i)-1,'ForecastCountMonth');
TRACE $(vCivilMonthYear) <= vCivilMonthYear;
Concatenate LOAD
Country,
Month,
ActualSales as SalesAmount,
Autonumber(Country & ' - ' & Date(Month, 'MM/YYYY')) as %KEY,
Country & ' - ' & Date(Month, 'MM/YYYY') as CountryMonth,
Date($(#vCivilMonthYear), 'MM/YYYY') as MonthOfForecast,
'ACTUAL' as %DATASOURCE
Resident Actual
Where Date($(#vCivilMonthYear), 'MM/YYYY') > MonthActual ;
Next i
DROP Tables Actual, ForecastCountMonth;
My solution:
ForecastCountMonth:
LOAD
Distinct Date(MonthOfForecast, 'MM/YYYY') as MonthOfForecast
Resident Forecast;
LET vNbForecastMonth = NoOfRows('ForecastCountMonth');
TRACE $(vNbForecastMonth) <= Number of MonthOfForecast;
Merge:
LOAD
Country,
Month,
MonthOfForecast,
ForecastSales as SalesAmount,
Autonumber(Country & ' - ' & Date(Month, 'MM/YYYY')) as %KEY,
Country & ' - ' & Date(Month, 'MM/YYYY') as CountryMonth,
'FORECAST' as %DATASOURCE
Resident Forecast;
DROP Table Forecast;
FOR i = 1 to $(vNbForecastMonth)
LET vCivilMonthYear = peek('MonthOfForecast', $(i)-1,'ForecastCountMonth');
TRACE $(vCivilMonthYear) <= vCivilMonthYear;
Concatenate LOAD
Country,
Month,
ActualSales as SalesAmount,
Autonumber(Country & ' - ' & Date(Month, 'MM/YYYY')) as %KEY,
Country & ' - ' & Date(Month, 'MM/YYYY') as CountryMonth,
Date($(#vCivilMonthYear), 'MM/YYYY') as MonthOfForecast,
'ACTUAL' as %DATASOURCE
Resident Actual
Where Date($(#vCivilMonthYear), 'MM/YYYY') > MonthActual ;
Next i
DROP Tables Actual, ForecastCountMonth;