Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Weeks Functionality


Hi

I have a list box containing "Weeks" which I used the script:

"(WeekStart("RE_DAY"))&'-'& Day(WeekEnd("RE_DAY"))&'  Week'& Week("RE_DAY") as Weks.

It shows weeks from 1 to 52

2014-12-07_17-16-14.png

How can I make it to show Week1 to Week4 or Week5 for every month? and how can I remove the "- Week" text in the list box?

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

A quick search found this :

    'Week'&Ceil(Day(Date)/7) as  MonthlyWeek



from Month Week ( 1 to 4 or 5 weeks)

View solution in original post

7 Replies
its_anandrjs

Hi,

It seems there is some null values in the date field thats why you get - n the Week field. That why you get nothing in the week field you can check in the "RE_DAY" field.

You can try also

=If( Len(Day(WeekStart("RE_DAY"))) >0, Day(WeekStart("RE_DAY")) ) &'-'&
If( Len(Day(WeekEnd("RE_DAY"))) > 0, Day(WeekEnd("RE_DAY"))) &' Week'& Week("RE_DAY") as Weks

But i recommend check the RE_DAY  field for null values.

Regards

Anand

Not applicable
Author

Hi Anand

Thanks for your rep;ly. The RE_DAY field does indeed contain NULL values, so it makes sense now.

I applied your script and I still get weeks in (1-52). I think the "Week" function is not an option here as I would like to see every month's weeks as Week1, Week2, Week3, Week4. Is there any fuction that can give me that?

2014-12-07_20-33-58.png

Anonymous
Not applicable
Author

A quick search found this :

    'Week'&Ceil(Day(Date)/7) as  MonthlyWeek



from Month Week ( 1 to 4 or 5 weeks)

Not applicable
Author

Thanks Bill , That works perfectly. Thank you too Anand

its_anandrjs

Hi,

You can try this way also


'Week'&Ceil(Day("RE_DAY")/7) &' - '&Month("RE_DAY") as  MonthlyWeekField

Regards

Anand

Not applicable
Author

I'm getting duplicates for some dates with different week numbers

2014-12-07_21-10-11.png

Any idea why I'm getting this?

anbu1984
Master III
Master III

Can you post sample app