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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
n1ef5ng1
Creator
Creator

Line chart showing Current and Previous Year

I have this line chart dimension is

1) Month

2) Year

On the expression, I have

1) sum(Sales)

I would like the line chart to show two line chart, current year (2014) and previous year (2013) without user to make any selection.

Is there anything that I can edit on the Year Dimension to show 2013 and 2014 as for this year? Current and previous year

Capture.GIF.gif

1 Solution

Accepted Solutions
Not applicable

HI, Benn.


=if( Year>=Year(AddYears(today(),-1)), Year)

and Suppress When Value Is Null Check, If you want.

a year later, can be sustain

View solution in original post

4 Replies
nizamsha
Specialist II
Specialist II

In Dimension u can write

If(year>2012,Year)

Another Month as Dimension and expression as sum(Sales)

nizamsha
Specialist II
Specialist II

U can do this in another way if u like mean

Month as Dimension

write 2 expression one for current year and one for previous year

like this

Sum({$<year={"$(=Max(Year))"}>}Sales) for Current Year

Sum({$<year={"$(=Max(Year)-1)"}>}Sales)  For previous Year

n1ef5ng1
Creator
Creator
Author

this will be 'hard coding' way, tedious to maintain when years to come

Not applicable

HI, Benn.


=if( Year>=Year(AddYears(today(),-1)), Year)

and Suppress When Value Is Null Check, If you want.

a year later, can be sustain