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: 
Anonymous
Not applicable

Is This Expression is correct Sum({$<year={'$(=Year)','$(=$(=(Year)-1})'}>}Sales)??


Hi Guys,

              I post an expression regarding sum of sales for Current selection and Previous selection of Year..Is that correct expression??

11 Replies
MK_QSL
MVP
MVP

=SUM({<Year  = {'>=$(=Max(Year)-1)<=$(=Max(Year))  '}>}Sales)

or

=sum({$<Year={$(=max(Year)),$(=max(Year)-1)}>} Sales)


is not working?

Joseph_Musekura
Support
Support

Hi,

You need to use # in dollars expansion when dealing with Numeric varaible (see an extract from QlikView reference manual )


Dollar-Sign Expansion Using a Variable

When using a variable for text replacement in the script or in an expression, the following syntax is used:

$( variablename )

$( variablename) expands to the value in variablename. If variablename does not exist the expansion will

be the empty string.

For numeric variable expansions, the syntax $( variablename ) will generate a number using the regional decimal

separator, i.e. for many countries a decimal comma. Such an expansion should not be used for numbers

inside the script since these must use decimal point. Instead the expansion $(# variablename ) should be

used. (Note the hash sign). It always yields a valid decimal-point representation of the numeric value of variablename,

possibly with exponential notation (for very large/small numbers). If variablename does not exist

or does not contain a numeric value, it will be expanded to 0 instead.