Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How I can calculate the number of days in a quarter? I like variables the quarter and year.
Given that depending on whether the year is a leap year the number of days in the 1st quarter will vary.
Greetings and thank you very much.
Translated with Google Translate - Qlik Community Administrative Team
¿Cómo puedo calcular el número de días de un trimestre? Tengo como variables el trimestre y el año.
Teniendo en cuenta que dependiendo de si el año es bisiesto el número de días del 1º trimestre variará.
Saludos y muchas gracias.
I think, if your year and quarter field are
Year
Quarter (Q1, Q2, Q3, Q4)
floor(QuarterEnd(makedate(Year, Right(Quarter,1)*3))) - floor(QuarterStart(makedate(Year, Right(Quarter,1)*3))) + 1
makedate to get the date in the quarter
quarterstart/end to get the first/last date of the quarter
datequarterend - datequarterstar +1
floor is because I want a date and the 2 functions quarterstart/end return a timestamp
I think, if your year and quarter field are
Year
Quarter (Q1, Q2, Q3, Q4)
floor(QuarterEnd(makedate(Year, Right(Quarter,1)*3))) - floor(QuarterStart(makedate(Year, Right(Quarter,1)*3))) + 1
makedate to get the date in the quarter
quarterstart/end to get the first/last date of the quarter
datequarterend - datequarterstar +1
floor is because I want a date and the 2 functions quarterstart/end return a timestamp