Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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??

Tags (1)
13 Replies

Re: Creating a week field based on system date?

What's the significane of system date here? WeekEnd would be a weekend right, or am I missing something important here?

MindaugasBacius
Valued Contributor II

Re: Creating a week field based on system date?

I strongly recommend you in the Master calendar just add one additional flag like:

If(weekday(date) = 6, 1, 0) as Weekend_flag;

Not applicable

Re: Creating a week field based on system date?

I have one date field in data, but i should not use that date field to get the weekend dates, so i thought that it can be done using system date, if any other possibility, let me know

Thanks

Prashanth

Re: Creating a week field based on system date?

Once again. I am not sure what system date needs to do here? System date should be 06/03/2015 (today), what does that need to do with the weekend? Do you just want the weekend based on Today's date? try this

WeekEnd(Today(), 0, 0)

Not applicable

Re: Creating a week field based on system date?

I have only one date field which i should not use to create weekend dates field. so i thought like system will do the job. Is there any possibility to get the same without any date column?

thanks

Prashanth

Not applicable

Re: Creating a week field based on system date?

Okay let me clarify you one thing. I have date field like

Postdate

05/04/2016

05/09/2016

05/15/2016

05/17/2016

I need to create weekend dates for respective records

Expected:

Postdate          CreatedWeendend

05/04/2016       05/08/2016

05/09/2016        05/15/2016

05/12/2016        05/0152016

05/17/2016        05/22/2016


thanks

Prashanth

Re: Creating a week field based on system date?

Try like this:

SET FirstWeekDay=0;

LOAD Postdate,

          WeekEnd(Postdate, 0, 0) as CreatedWeendend

FROM Source;


UPDATE:
Added an environmental variable

Not applicable

Re: Creating a week field based on system date?

sorry to confuse you, but I should not use the Post date field. Any other way that can do the job??

Re: Creating a week field based on system date?

But if you are using Postdate as reference point, how can you not use it? Outside QlikView how would you do this?

Community Browser