Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expr1 correspond to selected year Expr2 correspond to previous year

Hi QV,

In my dashboard I have a Year listbox(Data in it are : 2006,2007 to 2014) and a straight table with two dimensions and two expressions.

Expr1 : sum(Revenue YTD)

Expr2 : It should get the revenue of previous year.

Suppose from the list box I have selected year 2014, now Expr1 getting the revenue for selected year(i.e 2014) and Expr2 should display the previous year(i.e 2013).

How to write Expr2 for this. It should display dynamically i.e whatever the year I select from the year list box, Expr1 should display selected year revenue and Expr2 should display the previous year revenue.

Please help me on this.

Thanks,

Ananth

7 Replies
anbu1984
Master III
Master III

Expr2: sum({<Year={'$(=Max(Year)-1)'}>}Revenue YTD)

Not applicable
Author

Thanks for your response,

by this, I can get only 2013 revenue(static result)

but my requirement is, if I select 2007, expr2 should display 2006 revenue or if I select 2010, expr2 should display 2009 revenue

anbu1984
Master III
Master III

Are you getting 2013 revenue after selecting 2007?

Not applicable
Author

Not exactly, actually I'm getting zero values for previous year

Anonymous
Not applicable
Author

Make a variable for Year-1 : Var= Year-1

Now write the second expression as =sum({<Year={"$(Var1)"}>}Amount)

Not applicable
Author

If you can post your qvw, it will easier for us to help you.

anbu1984
Master III
Master III

Check this