<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to rank wrt non-chart dimensions for benchmarking in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-rank-wrt-non-chart-dimensions-for-benchmarking/m-p/169364#M40187</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I spent all day Friday trying to figure out how to benchmark with respect to a peer set, ignoring the chart dimensions. In my situation, I have an organization hierarchy, consisting of 7 levels, with level 7 being the lowest level. My challenge is to rank the selected member within level 7 and rank her against her peers (i.e. all other level 7 members sharing the same level 6 manager), for the current Question.&lt;/P&gt;&lt;P&gt;So my chart consists of one dimension and one expression: The dimension is my question (e.g. I have 10 questions I'm benchmarking for), the expression is my relative rank.&lt;/P&gt;&lt;P&gt;What makes this tricky (or nonintuitive) in QlikView is that the "rank" function will only rank across the chart dimensions. There is no way I have found getting around this. In fact, although the tool-tips show an option for group fields (e.g. total &amp;lt;fld1, fld2&amp;gt;, ...) I don't believe that total fields will ever work.&lt;/P&gt;&lt;P&gt;After sifting through all discussion on the matter, I was not able to find a solution to this problem. However, after some considerable thinking I have found a working solution that also has the added benefit of performing well - better perhaps than the rank function.&lt;/P&gt;&lt;P&gt;The "trick" to solving this problem comes from realizing that you don't need to actually sort the values - you only need to count the number of peer values greater than your selected member value.&lt;/P&gt;&lt;P&gt;I have pasted code below showing how this can be achieved. To keep things simple, I am using a variable called PeerSet. I am able to change the value of PeerSet depending on what level I am within the hierarchy, by way of a trigger. In fact in my situation, I also need to manipulate the chart expression itself, but for now you don't need to worry about those details.&lt;/P&gt;&lt;P&gt;Here is the PeerSet definition:&lt;BR /&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;PeerSet = {&amp;lt;MemberName_Level7= P({1&amp;lt;MemberName_Level6&amp;gt;} MemberName_Level7) - MemberName_Level7&amp;gt;}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Here is the expression definition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;&lt;BR /&gt;sum($(PeerSet)&lt;BR /&gt;aggr(&lt;BR /&gt; if(&lt;BR /&gt; avg($(PeerSet) FT_FormulaValue) &amp;gt;&lt;BR /&gt; avg(total &amp;lt;Question_Description&amp;gt;&lt;BR /&gt; aggr(avg(FT_FormulaValue), MemberName_Level7, Question_Description)&lt;BR /&gt; ),&lt;BR /&gt; 1&lt;BR /&gt; ),&lt;BR /&gt; MemberName_Level7, Question_Description&lt;BR /&gt;)&lt;BR /&gt;) + 1&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;One last note: The code from above is a distilled version of my actual code. I have not tested it, but it should work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Dec 2009 00:22:03 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-12-01T00:22:03Z</dc:date>
    <item>
      <title>How to rank wrt non-chart dimensions for benchmarking</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-rank-wrt-non-chart-dimensions-for-benchmarking/m-p/169364#M40187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I spent all day Friday trying to figure out how to benchmark with respect to a peer set, ignoring the chart dimensions. In my situation, I have an organization hierarchy, consisting of 7 levels, with level 7 being the lowest level. My challenge is to rank the selected member within level 7 and rank her against her peers (i.e. all other level 7 members sharing the same level 6 manager), for the current Question.&lt;/P&gt;&lt;P&gt;So my chart consists of one dimension and one expression: The dimension is my question (e.g. I have 10 questions I'm benchmarking for), the expression is my relative rank.&lt;/P&gt;&lt;P&gt;What makes this tricky (or nonintuitive) in QlikView is that the "rank" function will only rank across the chart dimensions. There is no way I have found getting around this. In fact, although the tool-tips show an option for group fields (e.g. total &amp;lt;fld1, fld2&amp;gt;, ...) I don't believe that total fields will ever work.&lt;/P&gt;&lt;P&gt;After sifting through all discussion on the matter, I was not able to find a solution to this problem. However, after some considerable thinking I have found a working solution that also has the added benefit of performing well - better perhaps than the rank function.&lt;/P&gt;&lt;P&gt;The "trick" to solving this problem comes from realizing that you don't need to actually sort the values - you only need to count the number of peer values greater than your selected member value.&lt;/P&gt;&lt;P&gt;I have pasted code below showing how this can be achieved. To keep things simple, I am using a variable called PeerSet. I am able to change the value of PeerSet depending on what level I am within the hierarchy, by way of a trigger. In fact in my situation, I also need to manipulate the chart expression itself, but for now you don't need to worry about those details.&lt;/P&gt;&lt;P&gt;Here is the PeerSet definition:&lt;BR /&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;PeerSet = {&amp;lt;MemberName_Level7= P({1&amp;lt;MemberName_Level6&amp;gt;} MemberName_Level7) - MemberName_Level7&amp;gt;}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Here is the expression definition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;&lt;BR /&gt;sum($(PeerSet)&lt;BR /&gt;aggr(&lt;BR /&gt; if(&lt;BR /&gt; avg($(PeerSet) FT_FormulaValue) &amp;gt;&lt;BR /&gt; avg(total &amp;lt;Question_Description&amp;gt;&lt;BR /&gt; aggr(avg(FT_FormulaValue), MemberName_Level7, Question_Description)&lt;BR /&gt; ),&lt;BR /&gt; 1&lt;BR /&gt; ),&lt;BR /&gt; MemberName_Level7, Question_Description&lt;BR /&gt;)&lt;BR /&gt;) + 1&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;One last note: The code from above is a distilled version of my actual code. I have not tested it, but it should work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2009 00:22:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-rank-wrt-non-chart-dimensions-for-benchmarking/m-p/169364#M40187</guid>
      <dc:creator />
      <dc:date>2009-12-01T00:22:03Z</dc:date>
    </item>
  </channel>
</rss>

