Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
yashcena
Contributor III
Contributor III

Hide Current Week's Data in Line Chart

I have a column named Work_Dt and I'm showing the number of hours for each work_dt in a line chart.

I want to hide the current week from line charts and show data till last week only. I have data starting from 2015.

I used this expression before:

=aggr(if(week[Work_Dt])< Week(Today()), [Work Dt]),[Work Dt])

Data in Work_Dt is like this:

Capture.JPG

So basically i'm comparing the week of work_dt with week of today().

Although it hides current week's data but it also has an unintended consequence. If the current week is week 45, then it is eliminating week 45 from all years and showing data till week 44 for all the historical years as well.

I think i need to add a condition for year in the expression but I'm not able to get the correct expression.

I hope I have made the requirement clear.

Thanks,

YASH

3 Replies
tresesco
MVP
MVP

You should rather filter by dates. May be like:

=if([Work_Dt])< WeekStart(Today()), [Work Dt])


And yes, aggr() might not be required.

yashcena
Contributor III
Contributor III
Author

Thanks Tresesco.....the expression worked for me.

In the line chart that I had created for these work dates, I was showing the value on the just the last week.

The expression that I used was this:

[Week] = $(=Week(Today())-1)

Capture.JPG

This was showing the data for just the last week but this expression also has the same issue of showing data for corresponding week number for previous years also. For example, if current week is week 2, then value should appear only on week 1 of 2018 and not  on week 1 of 2017 or 2016.

2018:

Capture.JPG

(value appearing on just the last week of 2018 i.e. week 1, current week of 2018 has been made hidden)

2017:

Capture.JPG

(value appearing on week 1 of 2017 also).

I tried using weekstart function here also but it did not work me. Any suggestion?

Thanks for your help!

YASH

tresesco
MVP
MVP

I guess, you have to use Set Analysis to by-pass the selection filter. Try to share a sample qvw and explain your expected output against few selections; let us work on your sample qvw to help.