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

Only display last weeks data

Hi Guys,

I have a couple of line charts and I wish to display only the last weeks data

The demension is :

sum({$<[Activity] = {"Unstructured Rollover"}>}(Number))

I have tried using a getselectedfields

GetFieldSelections(Week)<week() and Date>week(-1)

and if statements , but I cant quite get it to work,

Can anyone help please ?

Thanks

1 Solution

Accepted Solutions
IAMDV
Luminary Alumni
Luminary Alumni

Hi Mate,

I have mocked an example with your sample data. And I am using the below expression...

SUM({<MyDate = {"> $(=Date('08/02/2010') - 3)"} >} Sales)

I hope this helps!

Cheers - DV

View solution in original post

7 Replies
IAMDV
Luminary Alumni
Luminary Alumni

Hi,

Please can you post the sample QV document? You can scramble the data if you have sensitive information.

Thanks - DV

IAMDV
Luminary Alumni
Luminary Alumni

Hi Again,

Not sure if you wanted something like this...

=IF( GetFieldSelections(WeekNo) < Week(Today()), WeekNo -1)

Ofcourse, you have replace the field names based your data.

Please post the QV document if you cant get this working.

Cheers - DV

Not applicable
Author

Hi DV

Im not really sure how to go about building a sample Qlikview ,

I have an excel sheet - lets say today is the 9/2/10

Date              Sales      Name

01/02/2010     20           Anne

02/02/2010     15           John

03/02/2010     19           James

04/02/2010     16           Nuala

04/02/2010     16           James

05/02/2010     17           Nuala

06/02/2010     18           Steven

07/02/2010     15           Tracy

08/02/2010     14           Lisa

I need all the data in different parts of the QV doc, but for this chart I only need the data from the last 3 days,

The fields are called Date in the Script , can this be done with a getfieldselections ?

Thanks

Not applicable
Author

Meant to say my demensions are just Date and the expressions are all similiar to the following

sum({$<[Activity] = {"Unstructured Rollover"}>}(Number))

IAMDV
Luminary Alumni
Luminary Alumni

Hi Mate,

I have mocked an example with your sample data. And I am using the below expression...

SUM({<MyDate = {"> $(=Date('08/02/2010') - 3)"} >} Sales)

I hope this helps!

Cheers - DV

Not applicable
Author

Thanks DV

Think Ive sorted it !!

Not applicable
Author

another way to do it is to have a master calender where you can set various flags against date parameters such as below.

inweek(Date, today(), 0) * -1 AS [Calendar_CW],                                                                      //Current week

inweek(Date, addmonths(today(), -12), 0) * -1 AS [Calendar_FPW],                              //First prior quarter, same week last year

inweek(Date, addmonths(today(), -24), 0) * -1 AS [Calendar_SPW],                              //Second prior quarter, same week two years ago

if you have these flags created then all you need to reference in your set analysis is Calendar_CW = {'1'}.

IF you hold a master calendar you can then just link it to you data source or left join the data to you data table.  Search the forums for Master Calendar and you will find loads of posts.

Lewis