Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

oric1884
New 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
New Contributor III

Re: Using variable in Set Analysis

Hi again!

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

3 Replies
oric1884
New Contributor III

Re: Using variable in Set Analysis

Hi again!

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

shiva14358
New Contributor

Re: Using variable in Set Analysis

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

Paul_Antonio
New Contributor

Re: Using variable in Set Analysis

Thank you from the year of 2018. You made my day. Smiley Very Happy
Community Browser