Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
swetha54
Contributor III
Contributor III

How to see past 10 weeks data only in Line chart

Hi All,

I am trying to see only past 10 weeks data in Line chart. Week format is like DD/WW/YYYY.

KIndly hlep.

6 Replies
shiveshsingh
Master
Master

Hi

 

You need to extract the weekname from the format and then restrict the dimension to show only past 10 weeks data.

 

Can you share some sample data to work upon?

swetha54
Contributor III
Contributor III
Author

Hi,
Thanks for your reply!
the data is like 7/1/2018, 14/2/2018(second week), 21/3/2018(3rd week)..
shiveshsingh
Master
Master

If i understood correct, below code should work

Script:-

T:LOAD * INLINE [
Date
7/1/2018
14/2/2018
21/3/2018
];
F:
load Date, SubField(Date,'/',2) as Week

Resident T;

drop table T;

 

Now just use calculated dimension in which Week is less than or equal to 10, and use your expression.

 

swetha54
Contributor III
Contributor III
Author

Hi,

In a same year its working fine, but for last year and all the week number is not able to compare.

 

shiveshsingh
Master
Master

Okie, you need to put condition for Year too. Can you share sample data?

 

MK9885
Master II
Master II

Create a rolling field?
If( YOURDATEFIELD> WeekStart(WeekStart(today(),-9)) and YOURDATEFIELD<= today(),1,0) as [Week Rolling 10]
In front end use [Week Rolling 10] ={1} in Set Analysis but this would always show ONLY last 10 weeks of data for Year 2018
or use Week = {$(=Max(Week)-10)}
Week = 1, 2, 3....