QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
cancel
Showing results for
Did you mean:
Creator III

I want to compare records of the currently selected year and 2 years of its past?

I want to compare records of the currently selected year and 2 years of its past?

For example, if I currently select 1998 as the year it should compare 1996 year's subtotal with the 1998 year's subtotal, in bar chart

=sum({\$<OrderYear=getfieldselections(OrderYear)-2>}Subtotal)

I'm getting the desired result, with the above statement.Can you help me the above statement and correct if it has some mistake.Thanks in advance

1 Solution

Accepted Solutions
Master II

Hi,

try this way,

sum( {\$<OrderYear={"\$(=max(OrderYear)-2)"}>} Sales)

10 Replies
Champion

Hi,

=sum({\$<OrderYear={\$(=getfieldselections(OrderYear)-2)} >} Subtotal)

Or

=sum({\$<OrderYear={\$(=Max(OrderYear)-2)} >} Subtotal==> to always have a result displayed even if you select nothing on the OrderYear

hope it helps

Master II

Hi,

try this way,

sum( {\$<OrderYear={"\$(=max(OrderYear)-2)"}>} Sales)

Partner

Hi Baarathi,

Your above statement is correct if you want on another way like below:

Thanks,

Arvind Patil

Creator III
Author

Thanks a lot sir for the solution,But this expression "\$(=max(OrderYear)-2)"given within double quotes,can you explain me this part?

Creator III
Author

Thanks a lot sir.Can you explain this part '(=AddYears(max([OrderYear]),-2))' the contents given within single quotes will be treated as values right? can you please explain this part of your statement alone?

Creator III
Author

Thanks a lot sir.

Master II

Hi,

Single/double defined like this way

String value : Required single quotes within the element set

numeric value : do not require single or double quotes

expression or search : require double quotes

for more details check here,

A Primer on Set Analysis

Partner

Hi Bhaarthi,

1. AddYears function add number of years into your current date so if you add negative years (-2) so it minus from current date.

2. Single quotes treated as value.

Please add below code into text  box you will get idea: