6 Replies Latest reply: Jul 23, 2014 2:46 PM by Abhishek Agarwal

# 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.

• ###### Re: Using variable value in Set Expression

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

• ###### Re: Using variable value in Set Expression

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.

• ###### Re: Using variable value in Set Expression

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

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

• ###### Re: Using variable value in Set Expression

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.

• ###### Re: Re: Using variable value in Set Expression

see attach

• ###### Re: Re: Using variable value in Set Expression

Thanks so much Gabriela. It worked perfectly.