Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using variable value in Set Expression

Hi,

I'm trying to store one dynamic expression in a variable and then trying to utilize in the expression.

Variable:

vCurrent_Quarter = 1

vCurrent_Year = 2015

vNext_Quarter = If($(vCurrent_Quarter)=4,'Q'& 1 & ' ' & Right(($(vCurrent_year)+1),2),'Q'&($(vCurrent_Quarter)+1) & ' ' & Right($(vCurrent_year),2))

Expression: Sum({$<FQY = {'$(=vNext_Quarter)'}>} Amount)

Basically the FQY values are Q1 15, Q2 15 etc. and based on the Current year variable value, I want to produce the next quarter FQY value. For ex. if Current Quarter variable value is 1 then the FQY value should be Q2 15.

Thanks in advance for your help!!!

1 Solution

Accepted Solutions
gmoraleswit
Partner - Creator II
Partner - Creator II

6 Replies
Not applicable
Author

Simply add the new field called "Next Quarter"  to the Calendar table & use that field in Set Analysis.

gmoraleswit
Partner - Creator II
Partner - Creator II

I think you are missing another dollar sign expansion, try this:

Sum({$<FQY = {'$(=$(vNext_Quarter))'}>} Amount)

Anonymous
Not applicable
Author

This can be done but I don't want to manually do that stuff as today the requirement is to get the next quarter but what if when the requirement changes to have the next 2 quarter instead of next quarter.

Therefore, I want to achieve this behavior dynamically.

Anonymous
Not applicable
Author

Thanks Gabriela, but that is dollar sign is optional. Even if you wouldn't add the $ sign, qv assumes that you want to add $ and therefore a default behavior.

gmoraleswit
Partner - Creator II
Partner - Creator II

see attach

Anonymous
Not applicable
Author

Thanks so much Gabriela. It worked perfectly.