Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis for Line Chart that shows 2 previous before selection and 2 after selection in line chart

I would like to create a line chart and when I select on the volume list box I would like the line chart to show the previous two sales amounts before the selection, the selected value and the two sales amounts after the selection.  (A 2 prior / 2 post selection rolling report).

Just can figure out the set analysis of how to include the selection -2 and +2.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like attached?

In the script, I used

makedate(right(Volume,4),subfield(right(Volume,7),'/')) as Date

to create a Date with a numerical representation, which allows it to use this as line chart expression:

=sum({<Date={">=$(=addmonths(max(Date),-2))<=$(=addmonths(max(Date),2))"},Volume >} Sales)

Hope this helps,

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

Maybe like attached?

In the script, I used

makedate(right(Volume,4),subfield(right(Volume,7),'/')) as Date

to create a Date with a numerical representation, which allows it to use this as line chart expression:

=sum({<Date={">=$(=addmonths(max(Date),-2))<=$(=addmonths(max(Date),2))"},Volume >} Sales)

Hope this helps,

Stefan

Not applicable
Author

Thank you very much.