Вы находитесь на странице: 1из 6

The Magic of Set Analysis Syntax and Examples iQlik Everything ...

http://iqlik.wordpress.com/2010/09/11/the-magic-of-set-analysis-synta...

iQlik Everything QlikView.

Home About Contact

The Magic of Set Analysis Syntax and Examples


September 11, 2010

Syntax & Examples


In this new Post of The Series, I will go over the details for creating a correct Set Expression. Also, I will provide some useful examples for you to get your Hands On right away. Follow these steps to build up your set expression and use the correct syntax: 1. First of all, you need to define what you want your expression to return. A good method to get it right would be to answer the following questions first: What field will I use in my expression? (For example: Sales, containing the sales amount for every invoice.) How will I aggregate the field? (It can be using Sum, Count, Avg, etc.) What explicit selections do I need in my expression? Here you define a Field and its value(s). (For example: I want ONLY the South Region. Another example would be to only include values associated with certain Year.) Do I need to exclude/ignore some selections or values? 2. After youve answered the questions, you can go on to compse the expression. If you want to Sum the Sales amount, you would start with something like: Sum(Sales) 3. Then, whe need to add the Set portion of the expression.: This portion goes just after the first parenthesis, before the Field Name. The Set Expression will be enclosed in curly brackets: {set expression}. After the first curly bracket we add either a dollar sign (which means the record set will be based on the current selections) or a number 1 (meaning we will use the full record set of all the records in the application). We will use the dollar sign to illustrate, since it is the most common, so you will now have {$}. Important to note is that the dollar sign can be ommited and the set expression will not be affected. It is good practice, however, to use it. After the Dollar Sign, we define the fields that will play in our set expressions. All of these field-value definitions will be encolsed in less-than and grater-than symbols (< >). The syntax is FieldName = {FieldValue}. If FieldValue is a literal or text, you should enclose it in single quotes. If you want to use a search string as the FieldValue, enclose it in double quotes. Here are some examples: {$<Region = {South}>} will result in a record set taking the current selections ($) where the Field Region has a value of South. {$<Year = {2010}>} will give return a record set based on current selections ($) where the Year is 2010 EVEN if you select something else in the field Year.

1 of 6

2011-09-22 00:32

The Magic of Set Analysis Syntax and Examples iQlik Everything ...

http://iqlik.wordpress.com/2010/09/11/the-magic-of-set-analysis-synta...

{$<Year = {20*}>} will give you the record set based on the current selections where the Year matches the search string 20*, meaning all years that begin with 20. {$<Year = {>=2007}>} Will return a record set where the Year is greater than or equal to 2007. Notice that here we are using a search string. {$<Region = {South, North}, Year = {2010}>} will give you a record set based on the current selections where Region is equal to South or North and Year is equal to 2010. 4. Your final expression should look similar to: Sum({$<Region ={South}, Year = {2010}>} Sales) 5. You can use variables instead of the hardcoded Field Value: If your variable is a number, use it as Field = {$(MyVariable)} If your variable is text, use it as Field = {$(MyTextVariable)} If your variable should be used as a search string, use Field = {$(MySearchVariable)} 6. Also, you can create calculations to use them as Field Values: Year = {$(=Max(Year))} It is just as if you would use a variable (described above), just with an equal sign. NEVER forget the equal sign here. So, now you should be able to get up and running creating your set expressions. Remember: This is a basic introduction and there is A LOT more to know about Set Analysis, I will continue with the series to cover some more of it. Keep Posted. Any comments are welcome! EcoPressed
Eco World Content From Across The Internet.
FEATURED ON ECOPRESSED

Solar-Powered Bulb Provides Light After Dark

Share this:

Like this:

Be the first to like this post.

Entry filed under: Set Analysis, The Magic Of Set Analysis. Tags: Point in Time Reporting, Set Analysis, Syntax, The Magic of Set Analysis. The Magic Of Set Analysis. Introduction Reading iPhones Database

7 Comments Add your own


1. The Magic of Set Analysis Part III iQlik Everything QlikView. | November 27, 2010 at 11:20 am [...] Part II of The Series, I wrote about the general syntax of a Set Expression and provided some basic examples using Set [...] Reply 2. The Magic of Set Analysis Point In Time Reporting iQlik Everything QlikView. | November 27, 2010 at 2:14 pm [...] The Magic of Set Analysis Syntax and Examples [...]

2 of 6

2011-09-22 00:32

The Magic of Set Analysis Syntax and Examples iQlik Everything ...

http://iqlik.wordpress.com/2010/09/11/the-magic-of-set-analysis-synta...

Reply 3. Taxaw | June 25, 2011 at 11:18 am

Thanks Reply 4. DG | July 22, 2011 at 5:22 pm

Thanks for this good info. One question: In part 5 you show how to use a variable. Could I use a label reference?, i.e. a label reference as is discussed here in a different context: http://www.qlikfix.com/2011/06/21/testing-the-performance-implications-of-variables-and-labelreferencing-versus-direct-expressions/ Thanks DG Reply 5. Mike | August 4, 2011 at 11:22 pm

Hi DG, In the case of Set Analysis, it is not possible to use a label reference as Set Modifier because the Set (Data QlikView will use to perform the calculation) is defined only once and applies equally across all the chart dimensions. Using a Label reference would be in an attempt to use different Sets for each row (supposing it is a table), which is not possible. Thanks for your comment and hope I could help. Mike Reply 6. Qlikview User | August 3, 2011 at 7:48 am

Thank you for sharing. Very clear examples. You mentioned: If your variable is text, use it as Field = {$(MyTextVariable)} If your variable should be used as a search string, use Field = {$(MySearchVariable)} In what scenario do we use search string in set analysis? Can you please provide some examples? Also, Ive sen expression $($(=only(variable))) (i.e. that is the only line in the expression). Is it set analysis? What does it mean? Thank you. Reply 7. Hi! Mike | August 4, 2011 at 11:30 pm

3 of 6

2011-09-22 00:32

The Magic of Set Analysis Syntax and Examples iQlik Everything ...

http://iqlik.wordpress.com/2010/09/11/the-magic-of-set-analysis-synta...

$($(=only(variable))) is not a Set expression, dont get confused by the dollar signs. Dollar signs represent a whole other subject, called Dollar-Sign Expansion which basically I like to translate as evaluate/compute whatever is inside the parentheses (which are preceded by the dollar sign). It is most commonly used to get variables data because if your variable is an expression [for instance: Max(Year)], it will return the already-computed value (say, 2011). This is a pretty basic idea of Dollar-Sign expansion, but it is a topic on its own, with its syntax rules and everything. You may be able to find something already on the Qlik Community about the subject, or on other blogs (Check the blogroll on the sidebar). I will also consider it for future writings here in iQlik. Thanks for your comment. Mike Reply

Leave a Reply

Log In

Log In

Log In

Notify me of follow-up comments via email. Notify me of new posts via email.

Post Comment

Trackback this post | Subscribe to the comments via RSS Feed

Email Subscription
Enter your email address to subscribe to this blog and receive notifications of new posts by email. Join 59 other followers

4 of 6

2011-09-22 00:32

The Magic of Set Analysis Syntax and Examples iQlik Everything ...

http://iqlik.wordpress.com/2010/09/11/the-magic-of-set-analysis-synta...

Recent Posts
Power Up your Big Apps with Binary Index Expansion A New Choice of Armor: The Flag Matrix QlikView mobile: AJAX Touch Client Point In Time Reporting Out Of The Box The Magic of Set Analysis - Point In Time Reporting The Magic of Set Analysis Part III Reading iPhone's Database The Magic of Set Analysis - Syntax and Examples The Magic Of Set Analysis. Introduction Business Intelligence and Collaboration, the Twitter way!

Our Archives
September 2011 (1) May 2011 (1) April 2011 (1) January 2011 (1) November 2010 (2) September 2010 (2) August 2010 (1) July 2010 (1)

Post Categories
Collaboration (1) Data Model (1) Goodies (2) New Features (2) Personal Use (1) Random (1) Server (3) Set Analysis (5) The Magic Of Set Analysis (5) Uncategorized (1)

Calendar View
September 2010 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Aug Nov

5 of 6

2011-09-22 00:32

The Magic of Set Analysis Syntax and Examples iQlik Everything ...

http://iqlik.wordpress.com/2010/09/11/the-magic-of-set-analysis-synta...

Top Posts
The Magic of Set Analysis - Syntax and Examples The Magic of Set Analysis - Point In Time Reporting The Magic of Set Analysis Part III Point In Time Reporting Out Of The Box The Magic Of Set Analysis. Introduction

Blogroll
Quick Qlear Qool QlikView Notes Perceptual Edge The QlikFix!

Twitter
Power Up your Big Apps with Binary Index Expansion http://t.co/XMkhAFo 1 week ago To #QlikView Developers: What do you think about having pre-cached apps for better performance? Have you tried it? Do you recommend it? 4 weeks ago RT @EricaDriver: Collaborate on the future of #QlikView, with new Ideas functionality on #QlikCommunity, http://t.co/8TQE4U0 1 month ago thus opening up possible conflicts between the cached state and the modified state from a macro 1 month ago The reason for deleting the caches etc is that it is possible to modify properties and selections from the macros... 1 month ago Theme: Blix by Sebastian Schmieg . Blog at WordPress.com.

6 of 6

2011-09-22 00:32

Вам также может понравиться