Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

)Calculus of days in a quarter (Cáculo de días de un trimestre)

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.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

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

1.png

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

View solution in original post

1 Reply
maxgro
MVP
MVP

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

1.png

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