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: 
Not applicable

get quarter start month

Hi all,

how can i get the first month of a quarter + it's year from the following information:

From 2011-Q1 i want to get 201101

from 2011-Q2 i want to get 201104

etc

Thanks a lot!

1 Solution

Accepted Solutions
jvitantonio
Luminary Alumni
Luminary Alumni

so, I don't think this is a DATE field, so you'll need to do it with code. IF your field is a DATE field, you can you the function QuarterStart. In your example do:

Let's suppose the field that contains the value "2011-Q1" is called DATE

left(DATE,4) (this will give you 2011)

Then you can concatenate with '&' symbol.

=left(DATE,4)&IF(RIGHT(DATE,2)='Q1',01, IF(RIGHT(DATE,2)='Q2',04,IF(RIGHT(DATE,2)='Q3',07,10)))

View solution in original post

4 Replies
jvitantonio
Luminary Alumni
Luminary Alumni

so, I don't think this is a DATE field, so you'll need to do it with code. IF your field is a DATE field, you can you the function QuarterStart. In your example do:

Let's suppose the field that contains the value "2011-Q1" is called DATE

left(DATE,4) (this will give you 2011)

Then you can concatenate with '&' symbol.

=left(DATE,4)&IF(RIGHT(DATE,2)='Q1',01, IF(RIGHT(DATE,2)='Q2',04,IF(RIGHT(DATE,2)='Q3',07,10)))

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Have a look at the application.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
christophebrault
Specialist
Specialist

Where do you want to do this ?

In the script or in expression ?

I think there is many way to get your result, there is a simple i think :

If you have Quarters as a dimension, an expression like :

min(MonthName)

will give you good results.

Can you give us more details or exemple of what you want to do ?

Inscrivez vous à ma Newletter Qlik
DoNotMissQlik- Connect with me on Linkedin
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Check with this

     Left('2011-Q1',4)&Num(((Right('2011-Q1',1)-1)*3)+1,'00')

     If you want to make it as date then use like below

     Date#(Left('2011-Q1',4)&Num(((Right('2011-Q1',1)-1)*3)+1,'00'),'YYYYMM')

Celambarasan