Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to derive the quaters

How to derive the quarters like

Jan,Nov,Dec-Q1,Feb,Mar,Apr-Q2,May,June,July-Q3,Aug,Sep,Oct-Q4 and every quarter have 13 weeks

like week numbers Q1-1to 13 ,Q2-1 TO 13

6 Replies
Anil_Babu_Samineni

You can change your environment variable of monthstart

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
luismadriz
Specialist
Specialist

HI, maybe you could use this for Quarter?

'Q'&Pick(Num(Month(DateField)),1,2,2,2,3,3,3,4,4,4,1,1)

madhumitha
Creator
Creator

Hello Ashok,

Use below for week derivation

if(num(Right (WeekName(Today()),2)) <=13,'Q1',
if(num(Right (WeekName(Today()),2)) > 13 and num(Right (WeekName(Today()),2)) <=26,'Q2',
if(num(Right (WeekName(Today()),2)) > 26 and num(Right (WeekName(Today()),2)) <=39,'Q3',
if(num(Right (WeekName(Today()),2)) > 39 and num(Right (WeekName(Today()),2)) <=52,'Q4'
))))

luismadriz
Specialist
Specialist

Hi,

Please try this one:

Let vMinDate = Num(Today());

Let vRows = 368;

Dates: 

Load

DateField,

'Q' & Pick(Num(Month(DateField)),1,2,2,2,3,3,3,4,4,4,1,1) As Quarter,

'W' & Ceil(RangeMax((DateField - MakeDate(Num(Year(DateField))-If(Num(Month(DateField))=1,1,0),Pick(Num(Month(DateField)),11,2,2,2,5,5,5,8,8,8,11,11),1))/7,1)) as WeekNumber;

Load 

  Date($(vMinDate) - $(vRows) + IterNo()) as DateField

AutoGenerate 1 While IterNo() <= $(vRows);

luismadriz
Specialist
Specialist

Hi Ashok,

Just curious to see how did you go.

Remember to close it when you're done (Correct / Helpful)

Qlik Community Tip: Marking Replies as Correct or Helpful

Cheers,

Luis

luismadriz
Specialist
Specialist

Hi,

Just wondering to know how you went about this one,

Cheers,

Luis

PS. When applicable please mark the appropriate replies as Correct. This will help community members know which discussions have already been addressed and have a possible known solution. Please mark replies as Helpful if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as Helpful if you feel additional info is useful to others