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

Creating a week field based on system date?

Hi all there,

How can I create a weekend dates field using system date and weekend date should be every Sunday??

Example:

Weekend

05/01/2016

05/08/2016

05/15/2016

05/22/2016

05/29/2016

likewise for every month??

13 Replies
Not applicable
Author

I have a scenario like,

Week1:

Post date

03/31/2016

Week2:

Post date

03/31/2016

Week3:

Post date

03/31/2016

Week1:

Post date

03/31/2016

......

for a ticket which is pending in every week (I am getting data weekly), and I have number of tickets of this type.

I need to calculate how many tickets are pending greater than 7 days,

For the  scenario above mentioned, It should be counted in every week(expect first week).

For this purpose I need create a weekend for every week as I mention above.

(If I use the Post date to create the weekend, in every i am getting the same weekend)

sunny_talwar

Oh so you might need another date which is not linked to Postdate and may be do an IntervalMatch between Postdate as start date and Today as enddate and the mastercalendar to make this to work

Not applicable
Author

Exactly, and could you please elaborate to implement the same at script level

Note: If I have to use the mastercalndar I must use on date field, I should not use the one I have.

sunny_talwar

Something like this?

Capture.PNG

Script:

Table:

LOAD Tickets,

  Postdate,

  Date(WeekEnd(Postdate, 0, 0) + (7 * IterNo()) - 7) as CreatedWeendend

While WeekEnd(Postdate, 0, 0) + (7 * IterNo()) - 7 <= WeekEnd(Today(), 0, 0);

LOAD * INLINE [

    Tickets, Postdate

    A, 05/04/2016

    B, 05/09/2016

    C, 05/15/2016

    D, 05/17/2016

];