Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
roberto99
Contributor III
Contributor III

Calendar days / months and February always 29 days

Hello, I have a calendar with only months and days, but I need February to always generate 29 days, can I do it?

 

Spoiler

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

Labels (1)
5 Replies
marcus_sommer

What is the aim of it? Why creating an invalid date?

- Marcus

roberto99
Contributor III
Contributor III
Author

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

marcus_sommer

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

roberto99
Contributor III
Contributor III
Author

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?

marcus_sommer

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