Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
May 13, 2022 5:58:28 PM
Mar 25, 2015 3:29:11 PM
Set analysis offers a way of defining a set (or group) of data values that is different from the normal set defined by the current selections. Watch this video to learn more about the cool stuff you can do with Set Analysis as well as to get a better understanding of its expression syntax and how it can be used.
Previous Video: A Beginners' Introduction to Set Analysis
NOTE: For a more complete and deeper dive of Set Analysis check out this excellent document: Set Analysis: syntaxes, examples
Sample App: (Qlik Sense is .qvf - QlikView is .qvw)
Set Analysis Expressions:
Conditions (hard-coded lists,searches,wild card,comparison operators, not equal):
Sum({$<CategoryName={'Bath Clothes'}>}Sales)Sum({$<CategoryName={'Bath Clothes','Babywear'}>}Sales)
Sum({$<CategoryName={"*Clothes"}>}Sales)
Sum({$<CategoryName={"*Clothes",'Babywear'}>}Sales)
Sum({$<Year={'2013'}>}Sales)
Sum({$<Year={2013,2014}>}Sales)
Sum({$<Year={"<2014"}>}Sales)
Sum({$<Year-={2014}>}Sales)
Conditions using variables:
SET vDefaultCat = 'Bath Clothes';
Sum({$<CategoryName={$(vDefaultCat)}>}Sales)
$ Expansion - using functions to evaluate comparisons values:
Sum({$<Year={"$(=Year(Today()))"}>}Sales)
Conditions with multiple dimensions:
Sum({$<CategoryName={'Babywear'},Year={2014}>}Sales)
Conditions with measures:
Sum({<[Model Variation]={"=SUM(PartSales) >=1000"}>}PartSales)
Hi Rob,
Thank you so much for tip!
That was a misunderstanding from me! I didn't notice the position of "-".
Best Regards
Peyman
Hi Josephine - as per my other comment to you - post all discussion here: New to Qlik Sense - and then you can attach files, samples etc.
Let us know how else we can assist.
Mike T
Qlik
Thanks Michael, great video!
Hi, Michael!
In my data I do not have Year dimension, so I create a master dimension with the following expression: =Year(OrderDate). Works fine, sure. But when comes to define the mesure expression like Sum({$<Year={'2013'}>}Sales), it didn't work. I need to change it for Sum({$<OrderDate={"*2013"}>}Sales) as workaround. Can you explain me why?
Thanks for all videos, I'm learning a lot!
Marcelo Carahyba
Hi Marcelo - Unfortunately at this moment, dimensions / measures defined in the master library cannot be used within the set analysis expressions or other expressions. What you can do is define the new dervied field as using an expression as part of the original load script using the same expression - YEAR(ORDERDATE) as Year - for example - and then Year would work in the Set Analysis expressions.
Glad to see you are learning - stay tuned for more!
Hope this helps
Mike
Hi Michael et al
I am going crazy trying to see how QlikView is treating my numbers. I am wondering if the answer is set analysis. I thought I had solved my problem using the function Aggr - however - it works on an exmaple I made up but not in real life. Sorry not sure how to get the info here ...
Jo
rawQCLDate - rawCTDate = 8.8 (correct) (THIS WILL NOT TOTAL in QLIKVIEW)
sum({$}(rawQCLDate - rawCT)) = 77 (not even sure where that number is coming from
aggr(sum((rawQCLDate - rawCT)),UtilClinic) - gives me the same answer
UtilClinic | UtilPatName | URN | CT | QCL | Start Date | Count({$}[UtilPatName]) | QCL - CT | START - QCL | rawQCLDate - rawCT |
Neuro, | namex | 154100216 | 28/05/2015 11:30 | 10/06/2015 11:22 | 16/06/2015 0:00 | 1.0 | 13.0 | 5.5 | 13.0 |
Neuro, | namey | 151103763 | 9/06/2015 15:30 | 29/06/2015 10:40 | 30/06/2015 0:00 | 1.0 | 19.8 | 0.6 | 19.8 |
Neuro, | namez | 94100386 | 1/06/2015 13:00 | 10/06/2015 9:00 | 11/06/2015 0:00 | 1.0 | 70.7 | 0.6 | 8.8 |
Total | 3.0 | 103.5 | - | - | |||||
WHAT THE ANSWER SHOULD BE | 3.0 | 103.5 | 6.7 | 41.6 |
Thanks, Michael! It was my final workaround yesterday, put it in the load script. Great!
I think i have made a mistake in how i wrtoe the agg function !
Thx Michael,
Your presentations are fantastic, it made my day. Keep up the good work.
Thanks again
Theo
Some nice information and help