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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
siddheshmane
Creator
Creator

Set analysis.

Hi,

Can anyone explain to me what's the difference between these codes.

These two expressions are stacked...

sum({<Product-={Cap}>}Sales)

sum({<Product={Cap}>}Sales)

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

These two expressions are stacked...

sum({$-1<Product={Cap}>}Sales)

sum({1<Product={Cap}>}Sales)

I have tried understanding them. Have understood to some extent. The graphs are almost the same.. So what's the difference in the codes.

Thanks.

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

ExpressionExplanation
1Sum ( {<Product-={Cap}>} Sales)

Sum of Sales for Cap product limited to the rows in the current selection excluding

the product Cap. Current selection ($) is implied since there is no "identifier" in the set

expression. Sum( { $< Product -= {Cap} > }  Sales )  is equivalent to this

2Sum ( {<Product={Cap}>} Sales)Sum of all Cap products in your current selection. $ (current selection) is implied here.
3

Sum ( {$-1<Product={Cap}>} Sales)

Sum of Sales for all products in the current selection excluding the Cap products.

This will be a more efficient way of getting the same:

     Sum ( {$-$<Product={Cap}>} Sales)

4Sum ( {1<Product={Cap}>} Sales)

Sum of Sales for all Cap products. 1 is the identifier for "all rows" - but it will still

group them by the dimensions in your chart.

#1 and #3 should give the same result - although #3 is more efficient - or could be

#2 and #4 are different since #2 is only Sales considering the current selection and #4 is Sales of everything. In the case that you have not selected anything or selected everything #1 and #4 will give the same result.

View solution in original post

6 Replies
Not applicable

Hi,

1 Is use all data,ignoring selections:====sum({1<year={2015,2014}>})

$ Is use current selections:=====sum({$<year={2015,2014}>})

1-$ Is use all data and  excluded records:===sum({1-$<year={2015}>})

sum({<Product-={Cap}>}Sales) :- Returns record that belong to the first

but not the other of the two set identifiers

sum({<Product={Cap}>}Sales):- Returns record that belong to the first set identifiers


sum({$-1<Product={Cap}>}Sales):-Represent the next forward selections.

sum({1<Product={Cap}>}Sales):- Represent all data in to the application.

try once,

Thanks,

sreenu

amit_saini
Master III
Master III

Hi ,

Hope this will help u:

0 – empty set

1 – complete application

$ - current selection (take care that sometimes your chart or table does not use the current selection but an

Alternate States)

$1 – previous selection ($2: the second previous selection, etc.)

$_1 – next selection

Bookmark01 – name or ID of a bookmark

Group – group name (Alternate State)

Sum({Book1} [Sales]) : sales of the selection of Book1

Sum({Group1} [Sales]) : sales of the Alternate State Group1 (the syntax is identical)

Sum({1} [Sales]) : sum of everything (All dimensions are completely reset to All)

Sum({$} [Sales]) : sum of the current selection (= sum([Sales])

Sum({1-$} [Sales]) : sum of the sales of the « database » except the current selection

Thanks,
AS

petter
Partner - Champion III
Partner - Champion III

I am sorry but actually  $-1 is not the "next forward" selection ... You will have to use an underscore _ to get the "next forward" selection ... like this:

    $_1

Sum( { $-1<Product={Cap} } Sales) - represent:

       The rows for the current selection excluding all rows that have the field Product equal to Cap.

siddheshmane
Creator
Creator
Author

Hi,

From what I understood is that:


sum({<Product-={Cap}>}Sales) ----> Returns the record of the current selection except the Product Cap.

sum({<Product={Cap}>}Sales) ----> Returns the record of the current selection of the Product Cap.

sum({$-1<Product={Cap}>}Sales) ----> Returns the record of the current selection of the Product Cap.

sum({1<Product={Cap}>}Sales) -----> Returns the record of all  the data in the application for the Product Cap.


I had read somewhere that if the identifier is not specified it is assumed as $.


How far have I got this right?


jagan
Partner - Champion III
Partner - Champion III

Hi,

If $ sign is not specified then it always considers as a current selections.  $ is not a mandatory.

Regards,

Jagan.

petter
Partner - Champion III
Partner - Champion III

ExpressionExplanation
1Sum ( {<Product-={Cap}>} Sales)

Sum of Sales for Cap product limited to the rows in the current selection excluding

the product Cap. Current selection ($) is implied since there is no "identifier" in the set

expression. Sum( { $< Product -= {Cap} > }  Sales )  is equivalent to this

2Sum ( {<Product={Cap}>} Sales)Sum of all Cap products in your current selection. $ (current selection) is implied here.
3

Sum ( {$-1<Product={Cap}>} Sales)

Sum of Sales for all products in the current selection excluding the Cap products.

This will be a more efficient way of getting the same:

     Sum ( {$-$<Product={Cap}>} Sales)

4Sum ( {1<Product={Cap}>} Sales)

Sum of Sales for all Cap products. 1 is the identifier for "all rows" - but it will still

group them by the dimensions in your chart.

#1 and #3 should give the same result - although #3 is more efficient - or could be

#2 and #4 are different since #2 is only Sales considering the current selection and #4 is Sales of everything. In the case that you have not selected anything or selected everything #1 and #4 will give the same result.