Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

swetha54
New 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
Honored Contributor

Re: How to see past 10 weeks data only in Line chart

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
New Contributor III

Re: How to see past 10 weeks data only in Line chart

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

Re: How to see past 10 weeks data only in Line chart

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
New Contributor III

Re: How to see past 10 weeks data only in Line chart

Hi,

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

 

shiveshsingh
Honored Contributor

Re: How to see past 10 weeks data only in Line chart

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

 

MK9885
Honored Contributor II

Re: How to see past 10 weeks data only in Line chart

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