Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

no of months in current quarter

Hello guys ,

     What expression can we use to calculate number of months in current quarter??

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

=Month(QuarterEnd(Today())) - Month(QuarterStart(Today())) + 1

Regards,

Jagan.

View solution in original post

3 Replies
ashfaq_haseeb
Champion III
Champion III

Have Proper Master calendar

Let varMinDate = num(MakeDate(2000,1,1));

Let varMaxDate = num(MakeDate(2020,12,31));

//*************** Temporary Calendar ***************

TempCalendar:

LOAD

  $(varMinDate) + rowno() - 1 AS Num,

  date($(varMinDate) + rowno() - 1) AS TempDate

AUTOGENERATE

  $(varMaxDate) - $(varMinDate) + 1;

//*************** Master Calendar ***************

MasterCalendar:

LOAD TempDate AS Date,

  Week(TempDate) AS Week,

  Year(TempDate) AS Year,

  Month(TempDate) AS Month,

  year(TempDate)&'-'&Month(TempDate) as Year_Month,

  MonthName(TempDate) as YearMonth,

  Day(TempDate) AS Day,

  'Q'&ceil(month(TempDate)/3) AS Quarter,

  Month(TempDate)&'Q'&ceil(month(TempDate)/3) AS Month_Quarter

RESIDENT TempCalendar

ORDER BY TempDate ASC;

DROP TABLE TempCalendar;

Store MasterCalendar into MasterCalendar.qvd(qvd);

count (Month_Quarter) will give you all months in a specific quarter

Regards

ASHFAQ

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

=Month(QuarterEnd(Today())) - Month(QuarterStart(Today())) + 1

Regards,

Jagan.

MK_QSL
MVP
MVP

=NUM(MONTH(Today())) -NUM(Month(QuarterStart(Today()))) +1