Skip to main content

# New to Qlik Sense

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

Announcements
Skip the ticket, Chat with Qlik Support instead for instant assistance.
cancel
Showing results for
Search instead for
Did you mean:
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
Contributor III
Author

Hi again!

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

4 Replies
Contributor III
Author

Hi again!

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

Anonymous
Not applicable

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

Contributor II
Thank you from the year of 2018. You made my day. 😄
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?

Tags
Community Browser