Skip to main content Skip to complementary content

quarter Script and chart function

The quarter function returns a integer representing the quarter of the provided date. The returned value is between 1 and 4. The function can be used in both load scripts and chart expressions.

Syntax:  

quarter(date [, first_month_of_year])

Return data type: integer

quarter function arguments
Argument Description
date The date to evaluate.
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.

If not specified, the default value is 1.

When to use it

The quarter function is useful when you would like to compare aggregations by quarter. For example, the function could be used if you would like to see the total sales of products by quarter. It can be used to create new fields in the load script, as well as in calculated dimensions and set expressions.

Function examples
Example Result
quarter('10/29/2026') Returns 4.
quartername('10/29/2026', 3) Returns 3.

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.

Example – load script

Example 2 – chart expressions

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 – please let us know!