Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
oric1884
Contributor III
Contributor III

Using variable in Set Analysis

Hi there!

I'm trying to use set analysis in a kpi formula.

I define the following variables:

vYear2015 = 2015

vLastYear  = Max(Year) - 1

When I use vYear2015, my formula returns the correct value, but when I use vLastYear don't.

example:

Sum({1 <Year = { '$(vYear2015)' }>}  [Value])   => works

but

Sum({1 <Year = { '$(vLastYear)' }>}  [Value])   => does't work (returns 0)

I tried to use vLastYear at the kpi label and it works nice. (return 2015)

What I'm doing wrong?

Best regards,

1 Solution

Accepted Solutions
oric1884
Contributor III
Contributor III
Author

Hi again!

I found the answer: Sum({1 <Year = { '$( =$(vLastYear) )' }>}  [Value])

View solution in original post

4 Replies
oric1884
Contributor III
Contributor III
Author

Hi again!

I found the answer: Sum({1 <Year = { '$( =$(vLastYear) )' }>}  [Value])

View solution in original post

shiva14358
Contributor
Contributor

What is the use of operator 1 in that set? Remove it and you will find right answer.

Paul_Antonio
Contributor II
Contributor II

Thank you from the year of 2018. You made my day. 😄
merry2018
Creator III
Creator III

Hi Oric1884,
your answer are great and I can use it for my first table, but in the secound one I need to use that with more Numers there. For example like that "sum(<Year={'>=(-30-$(=$(vLastYear)))'}>VALUE)", but is not working.

What must I change or do other, that it will gooing?