Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products.
All content is subject to change and is provided without warranty.
Skip to main content Skip to complementary content

quarterend - script and chart function

This function returns a value corresponding to a timestamp of the last millisecond of the quarter containing date. The default output format will be the DateFormat set in the script.

Syntax:  

QuarterEnd(date[, period_no[, first_month_of_year]])

Return data type: dual

Diagram of the quarterend() function

Diagram that shows how the quarterend() function identifies the quarter that a date falls into and that it returns the last day of that quarter.

The quarterend() function determines which quarter the date falls into. It then returns a timestamp, in date format, for the last millisecond of the last month of that quarter. The first month of the year is, by default, January. However, you can change which month is set as first by using the first_month_of_year argument in the quarterend() function.

Information noteThe quarterend() function does not consider the FirstMonthOfYear system variable. The year begins on January 1 unless the first_month_of_year argument is used to change it.

The quarterend() function is commonly used as part of an expression when you would like the calculation to use the fraction of the quarter that has not yet occurred. For example, if you want to calculate the total interest not yet incurred during the quarter.

Arguments
Argument Description
date The date or timestamp to evaluate.
period_no period_no is an integer, where the value 0 indicates the quarter which contains date. Negative values in period_no indicate preceding quarters and positive values indicate succeeding quarters.
first_month_of_year If you want to work with (fiscal) years not starting in January, indicate a value between 2 and 12 in first_month_of_year.

You can use the following values to set the first month of year in the first_month_of_year argument:

first_month_of_year values
Month Value
February 2
March 3
April 4
May 5
June 6
July 7
August 8
September 9
October 10
November 11

December

12

Regional settings

Unless otherwise specified, the examples in this topic use the following date format: MM/DD/YYYY. The date format is specified in the SET DateFormat statement in your data load script. The default date formatting may be different in your system, due to your regional settings and other factors. You can change the formats in the examples below to suit your requirements. Or you can change the formats in your load script to match these examples. For more information, see Modifying regional settings for apps and scripts.

Default regional settings in apps are based on the user profile. These regional format settings are not related to the language displayed in the Qlik Cloud user interface. Qlik Cloud will be displayed in the same language as the browser you are using.

If you are an app creator, you can set the default region for apps you create. For more information, see Setting your preferred regional settings for creating apps and scripts in Qlik Cloud Analytics.

Function examples
Example Result
quarterend('10/29/2005') Returns 12/31/2005 23:59:59.
quarterend('10/29/2005', -1) Returns 09/30/2005 23:59:59.
quarterend('10/29/2005', 0, 3) Returns 11/30/2005 23:59:59.

Example 1 - Basic example

Example 2 - period_no

Example 3 - first_month_of_year

Example 4 - Chart object example

Example 5 - Scenario

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!