Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Meaning of "before the selected one"

I was reading up on the dollar-sign expansion in Qlikview.  Below is an excerpt on page 239 in

the Qlikview Reference Manual.  The last comment where they say "returns the year before the selected one".

Are they simply referring to the previous year? The verbage "... before the selected one" confuses me a bit.

------------

Dollar-Sign Expansion with an Expression

Expressions can be used in dollar-sign expansions. The content between the brackets must then start

with an equal sign:

$( =expression )

The expression will be evaluated and the value will be used in the expansion.

Example:

$(=Year(Today())); // returns e.g. '2008'

$(=Only(Year)-1); // returns the year before the selected one

------------

4 Replies
lironbaram
Partner - Master III
Partner - Master III

only function returns value only of you selected one value in a field

so in this case

it means the user selected one value in the year field

and the expression will return the value of the year before , otherwise the expression will return null

this is related to the only function and not to the $ sign

sunny_talwar

Yes previous year based on your selection. If you have selected 2007, then Year - 1 would be 2006

Bill_Britt
Former Employee
Former Employee

Hi,

The -1 just means the value before. If 2008 is select the $(=Only(Year)-1) would show 2007

Take a look at the attached.

Bill

Bill - Principal Technical Support Engineer at Qlik
To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.
Anonymous
Not applicable
Author

OK, so it's either the previous year (if a year is selected) or blank if no year is selected.

I got it now and thanks for the code snippet.