Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, I have a calendar with only months and days, but I need February to always generate 29 days, can I do it?
LET vMesActualAñoAnterior = MonthStart(Fecha,-12); // format dd/mm/yyyy
LET vMesActulaAñoAnteriormasTres = MonthEnd(Fecha,-10); //
LET vini = num(vMesActualAñoAnterior,'0');
LET vfin = num(vMesActulaAñoAnteriormasTres,'0');
CalendarioMaestro_trb:
LOAD
Date(IterNo()+$(vini)-1,'DD/MM') as Fecha_dm
AutoGenerate 1 While IterNo()+$(vini)-1<=$(vfin);
Calendar:
Load
Day(Fecha_dm)&'/'&month(Fecha_dm) as Fecha_dm,
Day(Fecha_dm) as Dia,
Month(Fecha_dm) as Mes
Resident CalendarioMaestro_trb;
drop table CalendarioMaestro_trb;
Thanks
What is the aim of it? Why creating an invalid date?
- Marcus
Hi, I have a comparison of expenses and sales per day, and when I compare 2021 with 2020 in February I am missing the day 29
I'm not sure that this would be a good idea. The calendar-days are different between the month and also between the (leap) years and weeks are overlapping between the months ... This means they couldn't be compared 1:1 else there will be always certain gaps and/or some blurring. Each attempt to force a comparison with artificial dimension-values creates rather more differences and confusing as it would be helpful.
Possible alternatives may be not to compare the calendar-day else the working-day or to apply a 4-4-5 or similar calendar or to use appropriate averages like sales per working-day on a week/month level or something similar.
- Marcus
I understand, it would be better then to change the date of the movements of that day when it is a leap year to the previous day?
No, this wasn't meant. Of course you may move/merge the values but this changes the data in a way which couldn't improve the analysis.
Personally I wouldn't do any adjusting of the dates and their values else if the data are analysed on a daily level I would display that there is nothing to compare on 29 Feb. and ignoring it because that's not wrong else it is as data are like and on a monthly level I would use the average per working-day.
- Marcus