Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
arulsettu
Master III
Master III

Date and Quarter

Hi,

     I am having a date field like this 426566. so i used below code

Date(TD_DOC_DT,'DD/MM/YYYY') as Trans_date

now i need month and quarter like    

     01/01 to 20/01 - jan

     21/01 to 20/02 - feb     q1

     21/02 to 20/03 - mar    

     21/03 to 20/04 - apr

     21/04 to 20/05 - may    q2

     21/05 to 20/06 - jun

     21/06 to 20/07 - jul    

     21/07 to 20/08 - aug     q3 

     21/08 to 20/09 - sep

     21/09 to 20/10 - oct

     21/10 to 20/11 - nov     q4

     21/11 to 31/12 - dec

i tried like this

if(daymonth>='1/Jan' and daymonth<='20/Jan','Jan',

  if(daymonth>='21/Jan' and daymonth<='20/Feb','Feb')) as Trans_detail_Month

plz suggest some ideas

thanks

1 Solution

Accepted Solutions
Anonymous
Not applicable

goto list box properties and select expression and insert this expression

=

if (day(TD_DOC_DT)<21 or (day(TD_DOC_DT)>=21 and month(TD_DOC_DT)='dec') , month(TD_DOC_DT), month(addmonths(TD_DOC_DT,1)))

it works with your app

View solution in original post

29 Replies
arulsettu
Master III
Master III
Author

any help guys?

Anonymous
Not applicable

just format as

=

date('31.03.2015','DD/MM/YYYY-MMM')   you get 31/03/2015-Mrz

fpr Quarter use ceil functtion

'Q' &

ceil(month(TempDate

) / 3))


arulsettu
Master III
Master III
Author

Hi Rudlof,

                 Format is not a issue. base on the date filed i need to create month like this

     01/01 to 20/01 - jan

     21/01 to 20/02 - feb    

     21/02 to 20/03 - mar   

     21/03 to 20/04 - apr

     21/04 to 20/05 - may  

     21/05 to 20/06 - jun

     21/06 to 20/07 - jul   

     21/07 to 20/08 - aug    

     21/08 to 20/09 - sep

     21/09 to 20/10 - oct

     21/10 to 20/11 - nov   

     21/11 to 31/12 - dec


thanks

Not applicable

Hi,

Try like this,

month(Date(TD_DOC_DT,'DD/MM/YYYY')) as Month


if(num(month(Date(TD_DOC_DT,'DD/MM/YYYY')))>=12 and num(month(Date(TD_DOC_DT,'DD/MM/YYYY')))<=2,'Q1',

if(num(month(Date(TD_DOC_DT,'DD/MM/YYYY')))>=3 and num(month(Date(TD_DOC_DT,'DD/MM/YYYY')))<=5,'Q2',

if(num(month(Date(TD_DOC_DT,'DD/MM/YYYY')))>=6 and num(month(Date(TD_DOC_DT,'DD/MM/YYYY')))<=8,'Q3',

if(num(month(Date(TD_DOC_DT,'DD/MM/YYYY')))>=9 and num(month(Date(TD_DOC_DT,'DD/MM/YYYY')))<=11,'Q3')))) as FinancialQuarter,

arulsettu
Master III
Master III
Author

Hi Harshal,

                    thanks for reply. how to create month like above

Anonymous
Not applicable

if day(yourdate)<21 or (day(yourdate)>=21 and month(yourdate)='dec'), month(yourdate), month(addmonth(yourdate),1)) delivers just jan, feb, ... dec

try it, should work

arulsettu
Master III
Master III
Author

i dint get you can you please check this one

arulsettu
Master III
Master III
Author

its giving error in addmonths part

Anonymous
Not applicable

sorry, my mistake assmonths instead of addmonth

,

if (day(yourdate)<21 or (day(yourdate)>=21 and month(yourdate)='dec') , month(yourdate), month(addmonths(yourdate,1))) as

monthofyourdate