Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Syntax: Use of Quotes in Set Analysis

Hi, I always struggle with where to use quotes. Usually I can get it to work after some trial and error, but this one has me baffled. I'm trying to write a statement to go find last quarter's result. I have a variable vCurrentQtr that stores a value (ex: 'Q3'). If true, this statement works fine, but if false it doesn't work. It has to do with how I'm parsing the quarter:

=If('$(vCurrentQtr)'='Q1',
Sum({$<FiscCalYr={'$(PreviousYear)'}, FiscCalQuarter={'Q4'} >} ResalePriceExtUSD),
Sum({$<FiscCalYr={'$(CurrentYear)'}, FiscCalQuarter={'Q' & Text(Num(Right('$(vCurrentQtr)',1)-1))} >} ResalePriceExtUSD)
)

So, I begin to troubleshoot...

This works: FiscCalQuarter={'Q3'}

This does not work: FiscCalQuarter={'Q' & '3'}

This does not work: FiscCalQuarter={$('Q') & $('3')}

So, how do I build a string concatenation then?

Can anyone help? I've spent hours going through every variation I could think of and it's still not working. I need to evaluate the number in 'Q3' so I can decrement.

Labels (1)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Yes, it is often not straightforward... Try if it works:
FiscCalQuarter={"$(='Q' & '3')"}

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Yes, it is often not straightforward... Try if it works:
FiscCalQuarter={"$(='Q' & '3')"}

Not applicable
Author

Hi, have you tried something like FiscCalQuarter={$(='Q' & Text(Num(Right('$(vCurrentQtr)',1)-1)))} ?