Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
ashraf_qlik
Partner - Contributor
Partner - Contributor

last o3 days add in week 4

Hi,

I have a column REPORT_DATE, to get the week wise i have loaded below in script

Ceil(Day([REPORT_DATE])/7) as Week1,

This giving me 05 weeks in the month ,wherever days are more than 28.

I want only 04 weeks &  last 03 days (29,30,31)  to be added in week 4 only

how to do that??

Thanks,

Ashraf

4 Replies
miskinmaz
Creator III
Creator III

You can try to hard code the week 5 to week 4, something like

 

if(Ceil(Day([REPORT_DATE])/7)=5,4,Ceil(Day([REPORT_DATE])/7)) as week1

ashraf_qlik
Partner - Contributor
Partner - Contributor
Author

Not working, i want only 04 weeks in my data, like below

 

Week1: 1-7

Week2: 8-14

Week3: 15-21

Week4: 22-28 & 29/30 or 31 (if any)

miskinmaz
Creator III
Creator III

can you post the sample app

Ezir
Creator II
Creator II

Hi @ashraf_qlik ,

Try like below:

Start

if((floor(day([REPORT_DATE])/7) * 7) - 6 < 0, 1,(floor(day([REPORT_DATE])/7) * 7) - 6) as startWeek

End

if(ceil(day([REPORT_DATE])/7)>4,(floor(day([REPORT_DATE])/7) * 7) + fmod(day([REPORT_DATE]),7),if(floor(day([REPORT_DATE])/7) * 7 = 0,7,floor(day([REPORT_DATE])/7) * 7)) as endWeek

 

 I hope helps you.