- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This Week and Last Week
Hi
I'm currently using the below boolean functions to get This Week and Last Week.
-InWeekToDate(Date,Today(),0) as CurrentWeek,
-InWeekToDate(Date,Today(),-1) as PreviousWeek,
For Current Week, it is showing Date as 08/08 and 08/07
and
For Last week, it is showing Date as 07/31 and 08/01.
I want to show Current Week from 08/07 - 08/13
and in the similar way Last week as well.
Can Someone help me in achieving this.
Besides this for Date Range Calculation i would like to use flag
For example, From Aug 1 - Aug 31 (full month Estimation using Flags)
I do not want Max(Date) as i have Dates after Aug 31 2016 as well
I need from Aug 1 2016 and Aug 31 2016 logic using Flags
Thanks
Satish
- Tags:
- qlikview_scripting
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be try this:
Table:
LOAD *,
InWeekToDate(Date, WeekEnd(Today()), 0) as CurrentWeek,
InWeekToDate(Date, WeekEnd(Today()), -1) as PreviousWeek;
LOAD Date(MonthStart(Today(), -1) + RecNo() - 1) as Date
AutoGenerate 44;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try using function InWeek() instead of InWeekToDate().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be try this:
Table:
LOAD *,
InWeekToDate(Date, WeekEnd(Today()), 0) as CurrentWeek,
InWeekToDate(Date, WeekEnd(Today()), -1) as PreviousWeek;
LOAD Date(MonthStart(Today(), -1) + RecNo() - 1) as Date
AutoGenerate 44;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Both solutions worked...
Thanks
Also how can we get the logic using flags for Date Range.
For example, the data should be displayed from Aug 1 - Aug 31 (Using Flags)
Currently i'm using
InMonthToDate(Date, Today(), 0)
Can i replace the above to
InMonthToDate(Date, MonthEnd(today(), 0) ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I feel that should work, what do you think Stefan?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It worked . But i will wait for you guys to confirm:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Best way is to test it out
Using the script:
Table:
LOAD *,
InWeekToDate(Date, WeekEnd(Today()), 0) as CurrentWeek,
InWeekToDate(Date, WeekEnd(Today()), -1) as PreviousWeek,
InMonthToDate(Date, MonthEnd(Today()), 0) as CurrentMonth;
LOAD Date(MonthStart(Today(), -1) + RecNo() - 1) as Date
AutoGenerate 365;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Satish Kurra wrote:
It worked . But i will wait for you guys to confirm:)
?
You want me to confirm what you already proved working? Why that?
It seems you like the more complex functions over the slighty more simple ones, note that there are a lot more functions to create flags for dates in the script, best to have a good read through the relevant date and time functions HELP pages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content