Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
aaronnayan
Creator III
Creator III

Date field to Quarters

Hi Guys

How would I include in my Qlikview doc the option to select date in Quarters

My date field is DECDDT

i.e. Q1, Q2, Q3, Q4

How would i do this in my script?

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

Dual('Q' & ceil(Month(DECDDT)/3) & ' ' & Year(DECDDT), Year(DECDDT)*10+ ceil(Month(DECDDT)/3)) AS Quarter,

View solution in original post

10 Replies
tresesco
MVP
MVP

What is "DECDDT" ? Could you explain your date field data format?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Just an example of how you can accomplish this in your Load Script:

:

Dual('Q' & ceil(Month(DECDDT)/3), ceil(Month(DECDDT)/3)) AS Quarter,

:


For further information: almost every MasterCalendar example script available in this Community shows you how to calculate the Quarter value from a date field. In different ways.

Anil_Babu_Samineni

Or simply

'Q' & Ceil(Month(DECDDT)/3) as Quarter

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
aaronnayan
Creator III
Creator III
Author

Hi Peter

Thankyou that helped tremendously, however it has grouped the years in together

q1= Jan 2016 feb 2016 mar 2016

        Jan 2017 feb2017  mar 2017

q2= apr 2016 may 2016  jun 2016

        apr 2017 may 2017 jun2017

I want the quarters to year specific, how can this be done?

Anil_Babu_Samineni

You mean to say, You have only 2016 and 2017 Data. Is that is correct, Although you can use same as perter and my suggestion to the en-count. If not, Please share sample data to look

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
aaronnayan
Creator III
Creator III
Author

yes Anil so i would like Q1 2016 then Q2 2016 and so on and so on

antoniotiman
Master III
Master III

Hi Aaron,

what about QuarterName() function ?

QuarterName('01-01-2017') ->  gen-mar 2017

Regards,

Antonio

Anil_Babu_Samineni

May be helps

quartername ‒ QlikView

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tresesco
MVP
MVP

Try like:

Dual('Q' & ceil(Month(DECDDT)/3) & ' ' & Year(DECDDT), Year(DECDDT)*10+ ceil(Month(DECDDT)/3)) AS Quarter,