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: 
arulsettu
Master III
Master III

month and quarter problem

Hi based on my date field i need to create month and quarter

  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


need to create quarter based on above month


as per  HRLinder

big help for month i did this


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,2))) as monthcheck



and for quarter

if (day(TD_DOC_DT)<21 or (day(TD_DOC_DT)>=21 and month(TD_DOC_DT)='dec') , 'Q' & ceil(month(TD_DOC_DT)/3), 'Q' & ceil(month(addmonths(TD_DOC_DT,2))/3)) as quartercheck



if i select 21st march it should show Q2. but it showing Q1.


so anyone can help me out


thanks


13 Replies
arulsettu
Master III
Master III
Author

any help guys

Anonymous
Not applicable

just write date(yourdatefield)

look at qvw, just reload (saved without data to save space)

arulsettu
Master III
Master III
Author

Hi Rudolf,

     i did this

date(TD_DOC_DT) as TD_DOC_DT,

  day(TD_DOC_DT) as TD_day,

  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,2))) as monthcheck,

  if (day(TD_DOC_DT)<21 , 'Q' & ceil(month(TD_DOC_DT)/3), 'Q' & ceil(month(addmonths(TD_DOC_DT,2))/3)) as quarter,

but no use. please correct me if i did any mistake

thanks

arulsettu
Master III
Master III
Author

i will check and tell u

thanks