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: 
joshabbott
Creator III
Creator III

Reference Current Dimension value in Set Analysis

Hello,

I have a straight table with a dimension of year (2008,2009,2010,2011).  I also have another field called year2, and there is no appropriate link between year and year2, year2 has no association.  What I want to do is get a total of sales as one of my expressions in my straight table based on the value of the dimension of the chart.  For instance:

sum({$<year2={WhateverTheYearImOnInTheChart} Sales)

So it would show:

2008 - $1000

2009 - $500

etc.

Could someone tell me how I could pass the dimension value (WhateverTheYearImOnInTheChart) to my set analysis expression?

Thank you!

3 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

A Set selection is executed once for the entire chart, so you can't vary by dimension. Instead use an if statement.

sum(if(year2=year, Sales))

-Rob

joshabbott
Creator III
Creator III
Author

Makes since, but it didn't work.  I believe it is treating year2 and year as text values and saying it never equals.  I'm attaching a sample based on the formula above.

joshabbott
Creator III
Creator III
Author

I don't think I described very well what I want to have happen, on the 2011 record, based on my test data, I want 500 displayed and so on, since year2 of 2010 is year of 2011.