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: 
Chanty4u
MVP
MVP

issue in expression

Hi all,   @sunny_talwar

 

i  have one variable like below.

=vPrevQtr

=chr(39)&concat(DISTINCT(Left(Quarter,4)-1)&Right(Quarter,2),chr(39)&','&chr(39)) & chr(39)

 

i have used  vPrevQtr in text object  its working fine its giving exact result..    but same varibale  used in  below expression its giving null.  As we have data for that   [its shwoing Expression is OK ]

if(GetFieldSelections(ServiceGroup) = '9R', Sum({$<Quarter={$(vPrevQtr)},Type={'Actuals'}>}Service_Amount),
if(WildMatch(getfieldselections(ServiceGroup),'*9R*'),Sum({$<Quarter={$(vPrevQtr)},Type={'Actuals','SKU'}>}Service_Amount),
Sum({$<Quarter={$(vPrevQtr)},Type={'Actuals'}>}Service_Amount)))

 where im doing wrong>?

 

Thanks

Labels (3)
16 Replies
vishsaggi
Champion III
Champion III

Can you try quotes around your variable like {'$(vPrevQtr)'} ?
vikramv
Creator III
Creator III

Try to replace this Quarter={$(vPrevQtr)} with Quarter=$(vPrevQtr) in set analysis.

As you already included the brackets and quotes in a variable ?

sunny_talwar


@Chanty4u wrote:

Hi all,   @sunny_talwar

 

i  have one variable like below.

=vPrevQtr

=chr(39)&concat(DISTINCT(Left(Quarter,4)-1)&Right(Quarter,2),chr(39)&','&chr(39)) & chr(39)

 

i have used  vPrevQtr in text object  its working fine its giving exact result.. 


When you say it works in text box object, what exactly do you mean? Can you show an image of what you see in a text box object when you use this?

Chanty4u
MVP
MVP
Author

Vikkyv getting error in set modifier adhoc element list ',' ) expected

Chanty4u
MVP
MVP
Author

Vishsaggi  am getting 0

Chanty4u
MVP
MVP
Author

qtr.PNG  Hi @sunny_talwar    when i select   in Quarter field   2019Q1 and 2019Q2    the text box result is  2018Q1,2018Q2   

if i select 2019Q1     result is getting 2018Q1 ...like that

HirisH_V7
Master
Master

Hi Suresh,

i just checked its working fine and picking the variables as it should. Even i created an example for the same. Below is screen shot for ref.Capture.PNG

 

i Guess there is some issue pertaining with other data parameters. Try removing them and check quarter alone first. attached is the sample qvw for ref.

HTH,

HirisH

HirisH
“Aspire to Inspire before we Expire!”
rubenmarin

Hi Suresh, I think your variable needs an starting equal sign:
SET vPrevQtr = =chr(39)&concat(DISTINCT(Left(Quarter,4)-1)&Right(Quarter,2),chr(39)&','&chr(39)) & chr(39);

If it's not possible to add the starting equal sign, maybe using the variable as:
Sum({$<Quarter={$(=$(vPrevQtr))}>}Quarter)
HirisH_V7
Master
Master

Check this with Half year and year updated.

PFA

HirisH
“Aspire to Inspire before we Expire!”