Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Variable

Hi

I have created the following variable in my QV doc

vYear=YEAR={'2015','2016'}

and I have written the below expression using the above variable

sum({$<DESCRIPTION = {GROSS_PREMIUM},YEAR=$(vYear)>}[ACTUAL])

But result is blank. Pls help me to correct my above expression

1 Solution

Accepted Solutions
ahaahaaha
Partner - Master
Partner - Master

Hi,

SET vYear={'2015','2016'};

Sum ({<Year=$(vYear)>}Value)

Result

1.jpg

Look attached file.

Regards,

Andrey

View solution in original post

8 Replies
0li5a3a
Creator III
Creator III

try this:

SET vYear={'2015;2016'}

sum({$<DESCRIPTION = {GROSS_PREMIUM},$(vYear)>}[ACTUAL])

Anonymous
Not applicable

Hi Upali,

is GROSS_PREMIUM a field or text? If it is a field, present like this this - [GROSS_PREMIUM]. If it is text, like this - 'GROSS_PREMIUM'.

try this:

SUM({$<DESCRIPTION={'GROSS_PREMIUM'},YEAR={'=$(=$(vYear))'}>}[ACTUAL])

Hope this helps

upaliwije
Creator II
Creator II
Author

It does not work

upaliwije
Creator II
Creator II
Author

I have tried it does not work

In fact

SUM({$<DESCRIPTION={'GROSS_PREMIUM'}>}[ACTUAL])  works well Once I add vYear it does not work

ahaahaaha
Partner - Master
Partner - Master

Hi,

SET vYear={'2015','2016'};

Sum ({<Year=$(vYear)>}Value)

Result

1.jpg

Look attached file.

Regards,

Andrey

Anonymous
Not applicable

Try this:

SUM({$<DESCRIPTION={'GROSS_PREMIUM'},YEAR={$(vYear)}>}[ACTUAL])

Anonymous
Not applicable

Try this


sum({$<DESCRIPTION = {GROSS_PREMIUM},YEAR={2014,2015}>}[ACTUAL])


or


vYear=max(year)-1

vCurrentYear=max(Year)


sum({<YEAR={$(vYear),$(vcurrentYear)}>}Sales)

sanjay006
Creator
Creator

sum({$<DESCRIPTION = {GROSS_PREMIUM},YEAR="$(vYear)">}[ACTUAL])

It might be possible that your variable is in string and you are passing the number in your set.