Set Analysis Beginners Guide v2.0[1]

August 13, 2017 | Author: Ramiro Avendaño | Category: Bracket, Summation, Function (Mathematics), Computer Programming, Areas Of Computer Science
Share Embed Donate


Short Description

Download Set Analysis Beginners Guide v2.0[1]...

Description

SET ANALYSIS

A BEGINNERS GUIDE

Version:

2.0

Date:

2013-10-29

Author(s)

FIM

CONTENTS Contents .................................................................................................................................. 2 Introduction ............................................................................................................................. 3 Basic Syntax ........................................................................................................................... 4 Examples .............................................................................................................................. 5 Dynamic Record Sets ............................................................................................................. 7 Adding and Removing Values to Selections ....................................................................... 9 More Examples ..................................................................................................................... 11

INTRODUCTION Qlikview Green/White/Grey functionality is a very simple and intuitive concept. A user makes a series of selections and narrows the application‟s data set and associated charts/reports. Set Analysis is Qlikview function that allows you to override this functionality and take control of the selections at an object or chart level. Set Analysis gives the developer complete control over which data is reported in the chart. The following are some scenarios where a developer may wish to use Set Analysis:   

To compare a measure for multiple time periods. To restrict values from fields in a calculation To Ignore or include some or all of the current selections To perform Cumulative calculations or Year to date results.

It is a very simple concept although the syntax can appear complicated.

Page | 3

BASIC SYNTAX The following example is used to show how a Set Analysis is composed; Sum of Sales for the country UK to include all current selections. The field to be used in the expression is SALES and the values in that field are to be added together therefore Sum is used. The starting point (IN BLACK) is:-

Sum(SALES) The Set portion of the expression is then added immediately after the first parenthesis and is enclosed in curly brackets {set expression} Immediately after the first curly bracket ({) a $ sign states that the record set will honor existing current selections and a 1 states that all current selections are to be ignored and the set analysis is to be based on a full data set. Since the example requires current selections to be included a $ is used(IN RED):-

Sum ({$}Sales) Next the field/s that will be used in the set expression are defined and these are added immediately after the $ and enclosed in less than / greater than () symbols(IN GREEN). In this example only records where country equals UK are to be included, the completed Set Analysis statement is:-

Sum ({$ } Sales) Or it can help, when reading a Set Statement to separate the syntax across multiple lines:-

Sum ( {$ } Sales)

Page | 4

EXAMPLES

Standard Sum of field Sales:-

SUM( SALES) Set Analysis style SUM of field Sales. The $ means that all current selections remain:SUM( {$} SALES)

Set style SUM of field Sales. The 1 means current selections are ignored:SUM( {1} SALES)

SUM of Sales for All(*) countries and including current selections:SUM( {$ } SALES)

Sum of Sales for all counties, excluding current selections:SUM( {1 } SALES)

Sum of Sales for United Kingdom and including current selections:SUM( {$ } SALES)

Page | 5

Sum of Sales for All Countries except United Kingdom, including current selections:SUM( {$ } SALES)

Page | 6

DYNAMIC RECORD SETS

Point in Time reporting is easily achieved using set analysis. If you wanted to obtain the years sales for 2010 the following set analysis would be used:-

Sum( {$ } Sales)

If you wanted to return Sales for the immediate previous year to whatever the user selects, you can use the aggregation function:-

First determine the function that will return the required value, Max(Year) – 1. In this example if the user selects 2010, the function will return 2009, if the user makes multiple selections or no selections at all, you will still get the value of the previous year based on the last possible year.

Next you use this function as a set modifier in the final expression, as follows:-

$(=Function()) (NB equal sign)

The final expression would look as follows:-

Sum( {$ } Sales )

Sum of Sales where Policy Created Year less than variable v2002:SUM( {$} Sales )

Sum of Sales where Policy Created Year greater than or equal to v2002 and less than or equal to v2004:SUM( {$} Sales )

Sum of Sales where Product not equal to Life Plan:SUM( {$} Sales )

Sum of Sales where Policy Created Year is greater than 1999 but less than 2004:SUM( {$1999} Sales ) Sum of Sales for policies created in the Years beginning “200*” :SUM( {$} Sales )

Sum of Sales excluding where Product equals *Plan* :SUM( {$} Sales )

Sum of Sales to include all current selections and the union of the 2 products, Life Plan and Fleet Secure:SUM( {$} Sales )

Sum of Sales to include all current selections and Years 20* and 1997 minus the year 2000:SUM( {$} Sales )

Page | 11

Sum of Sales to include all current selections, and the intersect of product Fleet Secure:-

SUM( {$} Sales )

This expression returns the sum of sales for the previous year in relation to the current selection. A dollar-sign expansion is used to calculate the previous year:SUM( {$} Sales )

Returns the sum of Sales for all current selections excluding the products with Plan and Secure in their title:SUM({$-1} Sales )

Return the sum of sales for all current selections, with a new selection in the “Customer” field. Only include customers who during 2007 had total sales of more than 1000000:SUM( {$ 1000000”}> } Sales )

Page | 12

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF