Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic Calculation of Previous Year Data

Hello:

I am very new to Qlikview - only 2 days so please excuse a simple question....





I have a column in the pivot table which displays the sales of the Year that was selected. E.g. if the Selection is for Year 2008, it displays data for the Sales for Year 2008 correctly using the SelYear formula: sum

However, I have another column in which I want to display the previous year's data of the Year selected. E.g. If the Selected Year is 2008 then I want to display the Sales data for Year 2007 in the second colmn called PrevYear.

({$<Year=(Year)>}Sales)/ 1000

The formula for PrevYear that I am using is: sum({$<Year=(Year-1)>}Sales)/1000 which does not give me the correct results for sales of 2007. It gives me the same value as in the first column which is the Sales for Year 2008.

Can somebody please help me.

Thanks.....Adi

1 Reply
Not applicable
Author

Hello

I just answered my own post THANKS to Mr. John Witherspoon's reply (details below):

John Witherspoon replied on 01-15-2010 7:44 PM

Using John's reply, I modified my formula to be: sum

({<Year={$(=Year-1)}>} Sales)/1000 and it worked perfectly.

Thanks John.

Adi