Qlik View Set Analysis Agenda 1 2 3

  • Slides: 16
Download presentation
Qlik. View Set Analysis

Qlik. View Set Analysis

Agenda 1. 2. 3. 4. What is Set Analysis? Why do we use it?

Agenda 1. 2. 3. 4. What is Set Analysis? Why do we use it? How do we use it (Syntax)? Examples

Set Analysis – What? Aggregation functions normally aggregate over the set of possible records

Set Analysis – What? Aggregation functions normally aggregate over the set of possible records defined by the current selection. Sum( Sales ) But an alternative set of records can be defined by a set expression. sum( {1<Region= {US} >} Sales )

Set Analysis – What? Hence: 1. Conceptually similar to a selection. 2. Provides a

Set Analysis – What? Hence: 1. Conceptually similar to a selection. 2. Provides a method of defining groups (sets) of information that are independent of the current selections. 3. Can create sets based on other sets. 4. Must be used in aggregation functions. 5. Always begins and end with curly brackets { }

Set Analysis – Why? • Very powerful functionality for comparison analysis – This year

Set Analysis – Why? • Very powerful functionality for comparison analysis – This year vs Last year comparisons – Products purchased vs Not purchased • Eliminate the need for additional, complex coding within an application. – No need for data islands (but data islands sometimes useful in conjunction with sets) – Reduces the need for Macro • Provides much more flexibility in the analysis, you can create – Expressions can be added for data outside of your current selection criteria.

Set Analysis – How? • The syntax is broken down into 3 categories: 1.

Set Analysis – How? • The syntax is broken down into 3 categories: 1. Set Identifiers 2. Set Operators 3. Set Modifiers

Set Analysis – How? • The syntax is broken down into 3 categories: 1.

Set Analysis – How? • The syntax is broken down into 3 categories: 1. Set Identifiers Sum( { 1 - $ } Sales ) Sum( {BM 01} Sales )

Set Identifiers 0 - Represents an empty set 1 - Represents the full set

Set Identifiers 0 - Represents an empty set 1 - Represents the full set of all the records in the application $ - Represents the records of the current selections $1 - Represents the previous selections $_1 - Represents the next (forward) selections Bookmark 01 - Represents the bookmark id or the bookmark name.

Set Identifiers Examples: Sum({1} Sales) Returns total sales within the application, disregarding the selections

Set Identifiers Examples: Sum({1} Sales) Returns total sales within the application, disregarding the selections but not the dimensions. Sum({$} Sales) Returns sales for the current selections i. e. the same as Sum(Sales) Sum( {$1} Sales) Returns the sales for the previous selections Sum({Bookmark 01} Sales) Returns sales for the bookmark named “Bookmark 01”

Set Analysis – How? • The syntax is broken down into 3 categories: 1.

Set Analysis – How? • The syntax is broken down into 3 categories: 1. Set Identifiers 2. Set Operators + Union Returns the set of all the records that belong to the unioned sets. - Exclusion Returns records that belong to the first but not the other of the two set identifiers. * Intersection Returns records that belong to both of the set identifiers / Symmetric Difference Returns a set that belongs to either, but not both of the set identifiers.

Set Operators Precedence: 1. Unary Minus (-) 2. Intersection and symmetric difference ( *

Set Operators Precedence: 1. Unary Minus (-) 2. Intersection and symmetric difference ( * , / ) 3. Union and Exclusions Within a group, the expression is evaluated from left to right.

Set Operators Examples: Sum( { 1 - $ } Sales) Returns sales for everything

Set Operators Examples: Sum( { 1 - $ } Sales) Returns sales for everything excluded by the current selections. Sum( { $ * Bookmark 01 } Sales) Returns sales for the intersection between the current selection and the bookmark “Bookmark 01” Sum({ - ($+Bookmark 01)} Sales) Returns sales excluded by current selections and bookmark “Bookmark 01”

Set Analysis – How? • The syntax is broken down into 3 categories: 1.

Set Analysis – How? • The syntax is broken down into 3 categories: 1. Set Identifiers 2. Set Operators 3. Modifiers sum( {$<Year = {2000}, Region = {US, SE, DE, UK, FR}>} Sales )

Set Modifiers A set can be modified by additional or changed selections. Such a

Set Modifiers A set can be modified by additional or changed selections. Such a modification can be written in the set expression. The modifier consists of one or several field names, each followed by selection(s) that can be made in the field. Modifiers begin and end with angle brackets <>.

Set Modifiers Examples: sum({$<Order. Date = Delivery. Date>} Sales) Returns the sales for the

Set Modifiers Examples: sum({$<Order. Date = Delivery. Date>} Sales) Returns the sales for the current selection where Order. Date = Delivery. Date. sum({1<Region = {US}>} Sales) Returns the sales for region US disregarding the current selection. sum({$<Region = >} Sales) Returns the sales for current selection, but with the selection in “Region” removed. sum({<Region = >} Sales) Returns same as the example above. When the set to modify is omitted, $ is assumed. sum({$<Year={2000}, Region={“U*”}>} Sales) Returns the sales for current selection, but with new selections both in “Year” and in “Region”.

Set Modifiers Advanced Searches Advanced searches using wildcards and aggregations can be used to

Set Modifiers Advanced Searches Advanced searches using wildcards and aggregations can be used to define sets. Examples: sum( {$– 1<Product = {“*Internal*”, “*Domestic*”}>} Sales ) returns the sales for current selection, excluding transactions pertaining to products with the string ‘Internal’ or ‘Domestic’ in the product name. sum( {$<Customer = {“=Sum({1<Year = {2007}>} Sales ) > 1000000”}>} Sales ) returns the sales for current selection, but with a new selection in the “Customer” field: only customers who during 2007 had a total sales of more than 1000000.