Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Straight table - actual vs previous year in different rows?

Hi all,

Maybe it's an easy question - but I can't find a way after spending a few hours with some ideas & looking around.

I've got a Year Dimension, restricted to only one selection. Now I want to have a straight table with:

Year

Sum(x)

2012 (actual selection)1000
2011 (actual selection-1)800


Displaying the actual selection and selection-1 is working fine by:

=ValueLoop((GetFieldSelections(Year))-1,(GetFieldSelections(Year)))

(as calculated dimension)

But...how do I set the filter to the data refering to the row? The only function I know is above, tried it with a negative offset but seems like it's not working.

I guess it's a simple problem and it seems like they had an example in qlikview v9, but I don't have the qvw (just saw it on a screenshot).

How can I solve this small problem?

Thanks

2 Replies
swuehl
MVP
MVP

I wouldn't use ValueLoop() for this, which creates a synthetic dimension, not connected to your data model.

Try using Year as dimension and then use a set expression to filter the data based on your selection:

=sum({<Year= {">=$(=max(Year)-1)<=$(=max(Year))"}>} Sales)

to show the sum of Sales for the selected Year and the Year before.

Hope this helps,

Stefan

MayilVahanan

Hi,

     Try like this,

     ValueLoop($(=Max(Year)-1),$(=Max(Year))) used as dimension..

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.