Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
KundanJyothsna
Contributor II
Contributor II

Create Monthly Week number Fields

Hi everyone,

 

I'm a newbie to qliksense. I have a requirement where I need to create week number fields per month as W1,WE,WE,W4 OR W5.

Please find the screenshot of the requirement.

Screenshot_20210115_230409.jpg

 

Labels (2)
5 Replies
rubenmarin

Hi @KundanJyothsna, if you have a Date field  you can assign the week as:

If(Day(MonthEnd(DateField))>=30 and Day(DateField)>21
  ,'W4'
  ,'W'&Ceil(Day(DateField)/7))
KundanJyothsna
Contributor II
Contributor II
Author

Hi @rubenmarin 

Thanks for your reply,

I have applied your code with my requirements which is as below

if(Day(MonthEnd(BUDAT_MKPF))>30 and Day(BUDAT_MKPF)>28, 'WK5') as WeekNo,
if(Day(MonthEnd(BUDAT_MKPF))=30,if(Day(BUDAT_MKPF)>21, 'WK4',
'WK'& Ceil(Day(TempDate)/7))) as WeekNo,

Where I'm unable to get WeekNumber Correctly for few dates.Please find the screnshot for the same 

KundanJyothsna_0-1611749267921.png

My requirement is as below 

Month with 28(ex: FEB )should show only upto weeks upto W4 i.e from 22-28 as W4

Month with 30 days(Ex: APR) should show only upto weeks upto W4i .e from 22-30 as W4

Month with 31 days(Ex: Mar) should show only upto weeks upto W5 i .e from 22-28 as W4 and from
29-31 as W5.

 

Can you please look into it and do the needful

 

Thanks in Advance

Jyothsna Kundan

 

KundanJyothsna
Contributor II
Contributor II
Author

Hi @rubenmarin 

 

Please find the requirement again

KundanJyothsna_3-1611749810522.png

 

rubenmarin

Hi @KundanJyothsna it should be

=If(Day(MonthEnd(DateField))<=30 and Day(DateField)>21
,'W4'
,'W'&Ceil(Day(DateField)/7))

Captura.PNG

KundanJyothsna
Contributor II
Contributor II
Author

Thanks alot @rubenmarin . It's resolved.