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

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
shiveshsingh
Master
Master

$ query

sum({<Year= {"$ (>=(Max(Month))"}>}Sales)

A bit confused, what if i put = sign before $ sign in string? Please let me know the difference

sum({<Year= {"=$ (>=(Max(Month))"}>}Sales)

7 Replies
vishsaggi
Champion III
Champion III

When ever you use = sign QV takes what ever it reads after = sign as an expression to be evaluated then compared to the field Year. May be not a good way of explaining. But that is what i believe. May be someone can give more insights on this.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I don't think either of the examples you posted would be valid syntax.  Both would return null. Here are some similar examples with valid sytax.

sum({<Year={2008}>}Sales)

Select the specific value 2008


sum({<Year={">=2008"}>}Sales)

Select >=2008. Use of the >= requires the double quotes.


Now using $() Dollar sign expansion (DSE) to provide  a dynamic value.  DSE is executed first to create a substitution, then then the expression is evaluated.


sum({<Year={$(vYear)}>}Sales)

Select the value of variable vYear.


sum({<Year={$(=Max(Year))}>}Sales)

Select the Max possible Year. Requires DSE. The = after the left paren indicates this should be evaluated as an expression.


sum({<Year={">=$(=Max(Year))"}>}Sales)

Same as above but testing for >=. Note that >= requires the double quotes. The >= goes before the DSE.

Some further reading.

The Magic of Dollar Expansions

Quotes in Set Analysis

-Rob

http://masterssummit.com

http://qlikviewcookbook.com



shiveshsingh
Master
Master
Author

Thanks Rob,

There was syntax error in expression.

Please help me in understanding significance of '=' sign before $

Sum({<Year={"=$(=Max(Year)-1)"},Month={'<=$(vMaxMonth)'}>}Sales)

Sum({<Year={"$(=Max(Year)-1)"},Month={'<=$(vMaxMonth)'}>}Sales)

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Sum({<Year={"=$(=Max(Year)-1)"},Month={'<=$(vMaxMonth)'}>}Sales)


As far as I know it is not valid to place a "=" before the "$" in this context.  Does this expression return results for you?


-Rob

shiveshsingh
Master
Master
Author

Hi Rob,

I am getting results if i put '=' sign before $. But it is different from without '=' sign.

I was checking this just out of curiosity.

pradosh_thakur
Master II
Master II

Is the result of

Sum({<Year={"=$(=Max(Year)-1)"},Month={'<=$(vMaxMonth)'}>}Sales)   same as

Sum({<Month={'<=$(vMaxMonth)'}>}Sales) or

sum(Sales) ?

Learning never stops.
shiveshsingh
Master
Master
Author

No