Skip to main content Skip to complementary content

quarterstart - script and chart function

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

Syntax:  

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

Return data type: dual

Diagram of quarterstart() function

Example diagram showing how the quarterstart function converts an input date into a timestamp for the first millisecond of the first month of the quarter in which this date occurs.

The quarterstart() function determines which quarter the date falls into. It then returns a timestamp, in date format, for the first millisecond of the first month of that 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.

When to use it

The quarterstart() function is commonly used as part of an expression when the user would like the calculation to use the fraction of the quarter that has elapsed thus far. For example, it could be used if a user would like to calculate the interest that has been accumulated in a quarter to date.

Function examples
Example Result
quarterstart('10/29/2005') Returns 10/01/2005.
quarterstart('10/29/2005', -1 ) Returns 07/01/2005.
quarterstart('10/29/2005', 0, 3) Returns 09/01/2005.

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.

Default regional settings in apps are based on the regional system settings of the computer or server where Qlik Sense is installed. If the Qlik Sense server you are accessing is set to Sweden, the Data load editor will use Swedish regional settings for dates, time, and currency. These regional format settings are not related to the language displayed in the Qlik Sense user interface. Qlik Sense will be displayed in the same language as the browser you are using.

Example 1 – No additional arguments

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!