Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I was going through some blogs and got stuck on a word 'Set analysis'. Can someone explain to me what is Set Analysis and how it is used. A little simpler explanation would be very much appreciated (I'm a complete newbie..Just 7 days into QV )
Thanks a lot.
Hi,
Go through below URL
It will help you
Set Analysis: syntaxes, examples
Go to QlikView Application's Help Menu
Go to Contents
Index
Type Set Analysis...
Details instruction is there...
You can also read below document
Set analysis is for Aggregating your data with reference to certain Sets(Selections or chunks/groups of data) of data
Set analysis consists of
identifier
operators
modifiers
syntax could be something like
Aggregation function ( Identifier{Selection <Dimension1 = {member 1, member 2, …} [, Dimension2 = {member 1, member 2, …}] >} Fieldname/expression)
Aggregation function can be any aggregate function Sum,count,avg,max, min etc
i.e Max(Fieldname)
but you dont want max of all fields with current selections you like to take max of particular set
there arises need of set analysis
identifier :
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 completly reset to All)
Sum({$} [Sales]) : sum of the current selection (= sum([Sales])
Operators :
+ : union of sets
*: intersection of sets
- : Exclusion of two sets
/ : members belonging to only one of the two sets
If you use the operators with the equal sign:
<Dimension += another set>: add the set to the current selection
<Dimension -= another set>: remove the set from the current selection
Sum({1-$} [Sales]) : sum of the sales of the « database » except the current selection
Sum({GROUP1 * Book1} [Sales]) : sum if the sales for the intersection of Group1 and Book1 (the
members belonging to both) Fabrice AUNEZ – version 2.1 The Sets Analysis-Page 5
The sets that we will study are between angle brackets : <>. They are quite more complex also. But you
may use also the operators:
{<set 1> -<set 2>} or {set 1}-{set 2}: members in the set1 that are not in the set2 (because we remove
them)
modifiers:
you can reduce or enlarge the scope of the
selection used in an aggregation. You may modify the selection for one or several dimensions.
<Dimension1 = {member 1, member 2, …} [, Dimension2 = {member 1, member 2, …}] >
part of the above syntax is Modifier
this will work like where cluase Dimnesion1 will be filtered with values in the { } seperated by comma
and similarly dim2 will be filtered with respective values
finally simple example
sum(1{<Dept={'IT'}>EmpSal} = this will return sum of IT dept emp sal irrespective of any selections made
sum(${<Dept={'IT'}>EmpSal} =this will return sum of IT dept emp sal with respect to selections made
sum({<Dept={'IT'}>EmpSal}= when no identifiers mentioned default if considered as $ current selection
sum(1{<Dept-={'IT'}>EmpSal}= this will return sum of emp sal except IT Dept, irrespective of any selections made
you can keep exploring all the identifiers operators and modifiers
you can find more details in reference manual or in even developer help
Thank you everyone. It was very easy to understand. Really helped me a lot.
Thanks again.