Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jblomqvist
Specialist
Specialist

How can I get the next Quarter from a selected date? Need to use it for Set Analysis to get Orders for selected date Quarter and it's next Quarter

Hi there,

I have a Date field called OrderDate.

From this OrderDate I dervice which Quarter a particular date is in.

What I would like to do is get the next Quarter from a selected OrderDate.

Currently I calculate a Quarter field in the script using 'Q' & CEIL(MONTH(TempDate) / 3) AS Quarter as part of standard master calendar.

Any idea how to get the next quarter?

Ultimately I want to use this in Set Analysis where I can show me Orders for this quarter and next quarter.

8 Replies
sibusiso90
Creator III
Creator III

You can easily create the quarter in the backend then use the field in your set analysis

jblomqvist
Specialist
Specialist
Author

Hi there,

Thanks for this, however my requirement is to get the next Quarter as a value from a selected date.

Any suggestions from anyone?

vikasmahajan

Hi

Create a master calendar and link your transactions to master calendar which will create date variables and fields further can be used in set analysis to calculate the required refer this link

SIMPLE MASTER CALENDER

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
sibusiso90
Creator III
Creator III

Made the something you looking for.

Please find the attached document it might be of help

jblomqvist
Specialist
Specialist
Author

Hi there,

I already have a master calendar.

This is not the issue.

What I want to know is, how can I get the next Quarter name as a value from the selected Order Date.

E.g. If I select 23/05/2017 then the current quarter is Q2.

The next Quarter value is Q3. I want this.

If I select 24/12/2016 then the current quarter is Q4, the next Quarter value is Q1. I want to hold this next Quarter value somewhere.

Digvijay_Singh

Try something like this -

'Q' & CEIL(MONTH(AddMonths(Max(Month_Date),3)) / 3)

boorgura
Specialist
Specialist

='Q' & left(QuarterEnd([Order Date], 1),1)/3

Please try the above expression.

HTH

arpitkharkia
Creator III
Creator III

Hi John,

Try using Autonumber function to create a unique number for each of your quarters and then you can easily use simple arithmetic expressions to get the required output.

LOAD *, 
AutoNumber(Quarter&Year) as QuarterNumber;