Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
marco_puccetti
Partner - Creator
Partner - Creator

Trimestral date computation

Hello i have a month sequence and i need to get the trimestral interval series for a linear graph, which functions can i use in the computed dimension field?

Thanks

Marco

10 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Add a field "Quarter" computed according month value so months between Jan and Mar belongs to quarter 1 and so on

Then use the new field in your analysis

SreeniJD
Specialist
Specialist

Hi

Try this,

Year(date_field) as Year,

Month(date_field) as Month,

'Q' & Ceil(date_field/3) as Quarter

Use this Quarter for your analysis!

HTH

Sreeni

marco_puccetti
Partner - Creator
Partner - Creator
Author

Doing so, i get a list of number, but to get the date and converting it with the date function, i get not exact dates.

How can i get the correct dates?

Thanks

Marco

SreeniJD
Specialist
Specialist

Hi Marco,

can you share some sample data for better analysis

Thanks,

Sreeni

marco_puccetti
Partner - Creator
Partner - Creator
Author

Simpy i have a list of data and i need to get in a linear graph a sequence of trimestral dates.

In the screeshot i report what i get using what you have reported.

Immagine8.png

What can be done to obtain what i need?

Thanks

Marco

swuehl
MVP
MVP

Try

LOAD

     [Data Decorrenza],

     QuarterStart([Data Decorrenza]) as [Trimestre di Decorrenza],

marco_puccetti
Partner - Creator
Partner - Creator
Author

Applied to the first date 07/11/2009 i get 01/10/2009, how does the function works?

Thanks

Marco

swuehl
MVP
MVP

QuarterStart(date [, shift = 0 [, first_month_of_year = 1]])

Returns a value corresponding to a timestamp with the first millisecond of the quarter containing date. The default output format will be the DateFormat set in the script. Shift is an integer, where the value 0 indicates the quarter which contains date. Negative values in shift indicate preceding quarters and positive values indicate succeeding quarters. If you want to work with (fiscal) years not starting in January, indicate a value between 2 and 12 in first_month_of_year.

Examples:

quarterstart ( '2005-10-29' ) returns '2005-10-01' with an underlying numeric value corresponding to '2005-10-01 00:00:00.000'

quarterstart ( '2005-10-29', -1 ) returns '2005-07-01' with an underlying numeric value corresponding to '2005-07-01 00:00:00.000'

quarterstart ( '2005-10-29', 0, 3 ) returns '2005-09-01' with an underlying numeric value corresponding to '2005-09-01 00:00:00.000'

marco_puccetti
Partner - Creator
Partner - Creator
Author

Ok the quarter can be usefull to compute the first date to use in an aggregation in order to create the trimestral date series.

At this point what could i use to create the trimestral date series variable within the script to insert in the graph?

Thanks

Marco