Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Bob07
Contributor II
Contributor II

Extracting Year_Quarter from Date Field

Hi,

I'm new to Qlik and I need help. I have a date field (purchase date) and want to extract the two fields (Year_quarter and Quarter_Start) using set expression or script. Kindly help.

Purchase Date Year_quarter Quarter_start
02/01/2023 2023-Q1 01/01/2023
15/11/2024 2024-Q4 01/10/2024

Thank you

Labels (1)
1 Solution

Accepted Solutions
BrunPierre
Partner - Master
Partner - Master

These;

Year([Purchase Date]) & '-Q' & Ceil(Month([Purchase Date]) / 3) AS Year_quarter,
QuarterStart([Purchase Date]) as Quarter_Start

View solution in original post

4 Replies
marcus_sommer

Take a look on the inbuilt functions quartername() and quarterstart():

quarterstart - script and chart function | Qlik Cloud Help

BrunPierre
Partner - Master
Partner - Master

These;

Year([Purchase Date]) & '-Q' & Ceil(Month([Purchase Date]) / 3) AS Year_quarter,
QuarterStart([Purchase Date]) as Quarter_Start

Bob07
Contributor II
Contributor II
Author

Thank you BrunPierre. I appreciate. 

Bob07
Contributor II
Contributor II
Author

Thank you Marcus, It was very helpful.