Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Last x Days

Hi Qlik Community,

I'm having troubles with date grouping. I want to be able to select data for the last 'x' number of days (last 7 days, last 30 days etc). I have some date grouping working fine (Today, Yesterday, This Week, Last Week etc.) but can't find a way to get the last x days.

I've attached a modified version of the excellent 'Date-Grouping.qvw' from the Qlikview Cookbook (Thanks Rob!). I've tried modifying the Inline table directly:

Last 7 Days; vToday; vToday-7

Which doesn't work. I've also tried assigning a variable:

LET vLast7Days=Date(today(1)-7);

...

Last 7 Days; vToday; vLast7Days

Which also doesn't work. I've stepped through the script load and the variables seem to assign properly but the end result is still not working.

Any help would be much appreciated!

Damien.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

A small mistake, the ordering of the variables were wrong in the inline part, correct it as:

Range; RangeStart; RangeEnd

Last 7 Days; vLast7Days; vToday

Last 30 Days; vLast30Days; vToday

I.e.- vToday should be there under RangeEnd instead of RangeStart.

View solution in original post

3 Replies
MK_QSL
MVP
MVP

tresesco
MVP
MVP

A small mistake, the ordering of the variables were wrong in the inline part, correct it as:

Range; RangeStart; RangeEnd

Last 7 Days; vLast7Days; vToday

Last 30 Days; vLast30Days; vToday

I.e.- vToday should be there under RangeEnd instead of RangeStart.

Not applicable
Author

Argh, so simple. Many Thanks