<?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 Selection logic / Set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849097#M297899</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I’ve a doubt that i don’t know if QV is able to solve with it’s logic. I’m attaching a QVW to show it.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Captura de pantalla 2015-07-10 a las 12.30.54.png" class="jive-image image-1" src="/legacyfs/online/92494_Captura de pantalla 2015-07-10 a las 12.30.54.png" style="height: 357px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My purpose is that if i select the value 5 and 9 of the field NIVEL3 and then select the value NO of the field USO, i will show only the possible IDSITIO that has NO for each values, 5 and 9.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example the iDSITIO 14692, has a SI in USO, for NIVEL3 = 5 so i want that it’s not listed as possible when i select 5,9 and NO. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand why is behaving, because i understand the QV logic, but i need this trick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need a set analysis like this&amp;nbsp; :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Concat(DISTINCT {$&amp;lt;&lt;/P&gt;&lt;P&gt;FlagCY={1},&lt;/P&gt;&lt;P&gt;M.FECHA={"&amp;gt;=$(#desde)&amp;lt;=$(#hasta)"},&lt;/P&gt;&lt;P&gt;USO={'Si'},&lt;/P&gt;&lt;P&gt;NIVEL3= {'1'},&lt;/P&gt;&lt;P&gt;IDSITIO= p({$&amp;lt;FlagCY={1},USO ={'*'}-{'Si'},M.NIVEL2 ={'01'},NIVEL3={'*'}-{'1'},M.FECHA={"&amp;gt;=$(#desde)&amp;lt;=$(#hasta)"}&amp;gt;} IDSITIO)&amp;gt;} IDSITIO,'","')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need IDSITIOS that has SI on NIVEL3=1 and NO on every other value of NIVEL3, not in someone of them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Albert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jul 2015 10:37:39 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-07-10T10:37:39Z</dc:date>
    <item>
      <title>Selection logic / Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849097#M297899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I’ve a doubt that i don’t know if QV is able to solve with it’s logic. I’m attaching a QVW to show it.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Captura de pantalla 2015-07-10 a las 12.30.54.png" class="jive-image image-1" src="/legacyfs/online/92494_Captura de pantalla 2015-07-10 a las 12.30.54.png" style="height: 357px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My purpose is that if i select the value 5 and 9 of the field NIVEL3 and then select the value NO of the field USO, i will show only the possible IDSITIO that has NO for each values, 5 and 9.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example the iDSITIO 14692, has a SI in USO, for NIVEL3 = 5 so i want that it’s not listed as possible when i select 5,9 and NO. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand why is behaving, because i understand the QV logic, but i need this trick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need a set analysis like this&amp;nbsp; :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Concat(DISTINCT {$&amp;lt;&lt;/P&gt;&lt;P&gt;FlagCY={1},&lt;/P&gt;&lt;P&gt;M.FECHA={"&amp;gt;=$(#desde)&amp;lt;=$(#hasta)"},&lt;/P&gt;&lt;P&gt;USO={'Si'},&lt;/P&gt;&lt;P&gt;NIVEL3= {'1'},&lt;/P&gt;&lt;P&gt;IDSITIO= p({$&amp;lt;FlagCY={1},USO ={'*'}-{'Si'},M.NIVEL2 ={'01'},NIVEL3={'*'}-{'1'},M.FECHA={"&amp;gt;=$(#desde)&amp;lt;=$(#hasta)"}&amp;gt;} IDSITIO)&amp;gt;} IDSITIO,'","')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need IDSITIOS that has SI on NIVEL3=1 and NO on every other value of NIVEL3, not in someone of them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Albert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 10:37:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849097#M297899</guid>
      <dc:creator />
      <dc:date>2015-07-10T10:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Selection logic / Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849098#M297900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe like attached?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 10:57:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849098#M297900</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-07-10T10:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Selection logic / Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849099#M297901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your response. Seems to be what i'm looking for, but i cant understand the =count double sentence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you adapt it to my set analysis expression or explain me what it does ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Concat(DISTINCT {$&amp;lt;&lt;/P&gt;&lt;P&gt;M.RESPUESTA ={'Si'},&lt;/P&gt;&lt;P&gt;M.MARCA = p(MARCALEVADURAF_T),&lt;/P&gt;&lt;P&gt;M.ID_SITIO_UNIFICADO = p({$&amp;lt;M.RESPUESTA ={'*'}-{'Si'},M.MARCA={'*'}-p(MARCALEVADURAF_T)&amp;gt;}M.ID_SITIO_UNIFICADO)&amp;gt;} &lt;/P&gt;&lt;P&gt;M.ID_SITIO_UNIFICADO,'","')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So many thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Albert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 11:55:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849099#M297901</guid>
      <dc:creator />
      <dc:date>2015-07-10T11:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Selection logic / Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849100#M297902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try: =concat({&amp;lt;NIVEL3={1}, USO={'Si'},IDSITIO=e({&amp;lt;NIVEL3-={1}, USO={'Si'}&amp;gt;}IDSITIO)&amp;gt;}IDSITIO,', ')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 12:22:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849100#M297902</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2015-07-10T12:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Selection logic / Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849101#M297903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is my expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Concat(DISTINCT {$&amp;lt;&lt;/P&gt;&lt;P&gt;USO={'Si'},&lt;/P&gt;&lt;P&gt;NIVEL3= {'1'},&lt;/P&gt;&lt;P&gt;IDSITIO= {"=count({$&amp;lt;USO ={'No'},NIVEL3 -= {'1'}&amp;gt;} NIVEL3)=count({1}distinct NIVEL3)-1"} &lt;/P&gt;&lt;P&gt;&amp;gt;} IDSITIO,',')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'double count' is an advanced search expression on field IDSITIO.&amp;nbsp; Basically it's telling QV to only consider IDSITIO where the &lt;/P&gt;&lt;P&gt;first count() equals second count()-1.&lt;/P&gt;&lt;P&gt;The first count will count the NIVEL3 per IDSITIO with a filter on USO = No and Nivel not equal 1.&lt;/P&gt;&lt;P&gt;The second count will count DSITINCT NIVEL3 per IDSITION ignoring any selections.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another solution could be&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;IDSITIO= {"=count({$&amp;lt;USO ={'No'},NIVEL3 -= {'1'}&amp;gt;} DISTINCT NIVEL3)=count({$&amp;lt;USO ={'No'},NIVEL3 -= {'1'}&amp;gt;} TOTAL DISTINCT NIVEL3)"} &amp;gt;} &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;The first count() was modified to only count DISTINCT NIVEL3, the second count() to count distinct NIVEL3 (excluding the ones with 'Yes' or NIVEL3 =1 across all IDSITIO.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;The way you change the search expressions, you might get different results based on the data in your data model, for example when one IDSITIO has not a complete set of NIVEL3 records (complete in a sense that all possible values of NIVEL3 appear for every IDSITIO), or maybe multiple records per NIVEL3 with different USO values.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Also Gysbert's solution is working fine, but may differ from mine when the data set is different from the one you've posted.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Mine is also regarding user selections on field IDSITIO, while you would need to apply the intersection operator * to Gysbert's if you want to do the same:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;=concat({&amp;lt;NIVEL3={1}, USO={'Si'},IDSITIO &lt;STRONG&gt;*=&lt;/STRONG&gt; e({&amp;lt;NIVEL3-={1}, USO={'Si'}&amp;gt;}IDSITIO)&amp;gt;}IDSITIO,', ')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Hence there might be different solutions necessary based on the full requirements of your business. There is no way around getting an understanding of how each solution works.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And sorry, I think I can't apply my solution to your posted set expression, since I don't have a full picture of all the fields stated therein.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jul 2015 11:10:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849101#M297903</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-07-11T11:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Selection logic / Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849102#M297904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much swuehl&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I solved my case with your accurate explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Albert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 09:06:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selection-logic-Set-Analysis/m-p/849102#M297904</guid>
      <dc:creator />
      <dc:date>2015-07-20T09:06:49Z</dc:date>
    </item>
  </channel>
</rss>

