<?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 Re: Set Analysis function in a KPI in Visualization and Usability</title>
    <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333982#M95420</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guiseppe,&lt;/P&gt;&lt;P&gt;There are contradictions between your initial post and the latest explanation, plus contradictions within this explanation itself.&amp;nbsp; Not to criticize, but to ask you to upload your application, or better a small example a similar application.&amp;nbsp; Otherwise it is not productive to continue guessing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Jul 2017 17:16:25 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-07-20T17:16:25Z</dc:date>
    <item>
      <title>Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333967#M95405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to understand why my expression doesn't work.&lt;/P&gt;&lt;P&gt;The expression is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15004570292166845" jivemacro_uid="_15004570292166845"&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt;"&gt;count( {$&amp;lt;[WeightValue] = {"=if(flag_01 = 1, 0.25, 0)+if(flag_02 = 1, 0.25, 0)+if(flag_07 = 1, 0.25, 0)"} &amp;gt;} ID_Client )&lt;/SPAN&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my table Client there is a column [WeightValue] that has always the value "0.25".&lt;/P&gt;&lt;P&gt;In the same table, i have 3 flags (flag_01, flag_02 and flag_03) which can assume the value 0 or 1.&lt;/P&gt;&lt;P&gt;I need to compare the value of the column [WeightValue] with the sum of the flags (as you can see in the expression).&lt;/P&gt;&lt;P&gt;In this case, I need to check if there are some client that have&lt;SPAN style="font-size: 10pt;"&gt; [WeightValue] = 0.25.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The KPI show me always the value 0 (so I can think that there are no Client that satisfy the equation).&lt;/P&gt;&lt;P&gt;But if I create a Table as ID_Client as Dimension and a Misure trought the funcion&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15004574975076777 jive_text_macro" jivemacro_uid="_15004574975076777"&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;if(flag_01 = 1, 0.25, 0)+if(flag_02 = 1, 0.25, 0)+if(flag_07 = 1, 0.25, 0)&lt;/SPAN&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;I can see that there are some client that have 0.25 as a result of the function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The KPI show me the correct value if I select one of ID_Client that satisfy the equation (when getSelectedCount(ID_Client) = 1 and the equation is satisfied).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help me, please to understand wich is the problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 09:47:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333967#M95405</guid>
      <dc:creator />
      <dc:date>2017-07-19T09:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333968#M95406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Giuseppe,&lt;/P&gt;&lt;P&gt;in Table You have implicit Aggr of Dim ID_CLIENT.&lt;/P&gt;&lt;P&gt;In KPI You need Aggr() function like&lt;/P&gt;&lt;P&gt;Sum(Aggr(Count(Expression),ID_CLIENT))&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Antonio&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 09:56:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333968#M95406</guid>
      <dc:creator>antoniotiman</dc:creator>
      <dc:date>2017-07-19T09:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333969#M95407</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;How about using nested if?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;count( {$&amp;lt;[WeightValue] = {"=if(flag_01 = 1,0.25,if(flag_02 = 1,0.25,if(flag_07 = 1,0.25,0)))"} &amp;gt;} ID_Client )&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 10:03:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333969#M95407</guid>
      <dc:creator>devarasu07</dc:creator>
      <dc:date>2017-07-19T10:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333970#M95408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, but it give me the same result.&lt;/P&gt;&lt;P&gt;After some tests, now the KPI works in a strange way.&lt;/P&gt;&lt;P&gt;If I select (from a filter) only the ID_Client that satisfy the equation, the KPI shows the exact value.&lt;/P&gt;&lt;P&gt;For example, if I select 5 ID_Client that has [WeightValue] = F(x), it shows 5.&lt;/P&gt;&lt;P&gt;But if I select 5 ID_Client that satisfy the equation, and only one ID_Client that doesn't satisfy the equation, the KPI shows me 0. It think was correct if it shows 5, not 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 10:15:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333970#M95408</guid>
      <dc:creator />
      <dc:date>2017-07-19T10:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333971#M95409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H6 style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hi - &lt;SPAN class="j-post-author" style="font-size: 0.9em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 11.7px; font-family: inherit;"&gt;&lt;A href="https://community.qlik.com/people/devarasu07"&gt;devarasu07&lt;/A&gt;‌ - but I need to sum the value of the flags (flag1+flag2+flag3).&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/H6&gt;&lt;P&gt;&lt;SPAN class="j-post-author" style="font-size: 0.9em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 11.7px; font-family: inherit;"&gt;The problem is not the nested if, the function works as I writed it.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author" style="font-size: 0.9em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 11.7px; font-family: inherit;"&gt;I don't understand the beaviour of the KPI&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 10:19:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333971#M95409</guid>
      <dc:creator />
      <dc:date>2017-07-19T10:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333972#M95410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set Analysis is evaluated once per object..&lt;/P&gt;&lt;P&gt;I think You need If() instead of Set Analysis in Your expression.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 10:24:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333972#M95410</guid>
      <dc:creator>antoniotiman</dc:creator>
      <dc:date>2017-07-19T10:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333973#M95411</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;Can you share your mock app and expected output. Tks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 10:27:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333973#M95411</guid>
      <dc:creator>devarasu07</dc:creator>
      <dc:date>2017-07-19T10:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333974#M95412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, but I can't share the app.. there are data that i can't show.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 10:41:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333974#M95412</guid>
      <dc:creator />
      <dc:date>2017-07-19T10:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333975#M95413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try if this helps:&lt;/P&gt;&lt;P&gt;count( {$&amp;lt;[WeightValue] = {"&lt;STRONG&gt;$(&lt;/STRONG&gt;=if(flag_01 = 1, 0.25, 0)+if(flag_02 = 1, 0.25, 0)+if(flag_07 = 1, 0.25, 0)&lt;STRONG&gt;)&lt;/STRONG&gt;"} &amp;gt;} ID_Client ) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 11:32:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333975#M95413</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-19T11:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333976#M95414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure I understand the problem, but it sounds like you just need a count of clientIDs where only 1 of the 3 flags is set to 1. I'm assuming that based on your if statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that's the case the easiest what to accomplish this is to just create a new field in the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's what it would look like in the script:&lt;/P&gt;&lt;P&gt;flag_01 + flag_02 + flag_07 as CountWeightFlag&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then your set analysis would look like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Count({&amp;lt;&lt;SPAN style="font-size: 13.3333px;"&gt;CountWeightFlag&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;={1}&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;ID_Client &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;If you don't have access to the script you can accomplish like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;count({&amp;lt;&lt;SPAN style="font-size: 13.3333px;"&gt;flag_01&lt;/SPAN&gt;={1}, flag_02={0}, flag_07={0}&amp;gt;}&lt;SPAN style="font-size: 13.3333px;"&gt;ID_Client &lt;/SPAN&gt;) + &lt;SPAN style="font-size: 13.3333px;"&gt;count({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;flag_01&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;={0}, flag_02={1}, flag_07={0}&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;ID_Client &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;)&amp;nbsp; + &lt;SPAN style="font-size: 13.3333px;"&gt;count({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;flag_01&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;={0}, flag_02={0}, flag_07={1}&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;ID_Client &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 11:51:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333976#M95414</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-19T11:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333977#M95415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H6 style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hi &lt;SPAN class="j-post-author" style="font-size: 0.9em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 11.7px; font-family: inherit;"&gt;&lt;A href="https://community.qlik.com/people/mov"&gt;mov&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; you writed the same function that I posted in my discussion.&lt;BR /&gt;Isn't it?&lt;/H6&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jul 2017 09:21:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333977#M95415</guid>
      <dc:creator />
      <dc:date>2017-07-20T09:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333978#M95416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I can try to write the function (I can't change the script) as you suggest, but there is the possibility that we will have a lot of flags so it become very hard to write all cases. &lt;/P&gt;&lt;P&gt;Is there another solution?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jul 2017 09:24:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333978#M95416</guid>
      <dc:creator />
      <dc:date>2017-07-20T09:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333979#M95417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nope.&lt;/P&gt;&lt;P&gt;Look carefully, I even used &lt;STRONG&gt;bold&lt;/STRONG&gt; for the characters I've added.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jul 2017 11:24:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333979#M95417</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-20T11:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333980#M95418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you you are going to have several flags this is something that should definitely be addressed in the script. In the mean time the solution I suggested is your best bet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jul 2017 13:21:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333980#M95418</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-20T13:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333981#M95419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I think i have omitted an important aspect about my application!&lt;/P&gt;&lt;P&gt;To semplify the problem, I haven't explained that the user can choose a weight that they want assign to each flag.&lt;/P&gt;&lt;P&gt;I mean there is a sheet that contains combo-boxes, one for each flags, throught which the user can choose "0.25" or "0.50" or "0.75" or "1". The user can assign a different weight to each flags.&lt;/P&gt;&lt;P&gt;For example, the user can assign weight 0.50 to flag_01, weight 0.75&amp;nbsp; to flag_02, and so on.&lt;/P&gt;&lt;P&gt;I create a varaiable for each flag, that contain the specific weight assigned to the user to the relative flag.&lt;/P&gt;&lt;P&gt;For example: vWeightFlag_01 = 0.50 , vWeightFlag_02 = 0.75, and so on.&lt;/P&gt;&lt;P&gt;So, in this way, the user can change each weight when he wants, and the process is totally dynamic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the reason why i can't do it throught the script, because the choice of weight is dinamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that each KPI can assume values 0 or 1.&lt;/P&gt;&lt;P&gt;If a KPI has value 0, then the weight is 0.&lt;/P&gt;&lt;P&gt;If a KPI has value 1, then the weight is that was selected by the user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the expression to define the correct weight for each flags is:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;if(flag_01 = 1, &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;vWeightFlag_01&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;, 0) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;if(flag_02 = 1, &lt;SPAN style="font-size: 13.3333px;"&gt;vWeightFlag_02, 0)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;..and so on..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Finally, I need to define some ranges and I need to count how many client are in each range.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;The measure is the sum of the weights of each flags.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;For the client001 the sum can be: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;if(flag_01 = 1, &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;vWeightFlag_01&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;, 0)&amp;nbsp; + &lt;SPAN style="font-size: 13.3333px;"&gt;if(flag_02 = 1, &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;vWeightFlag_02, 0) + &lt;SPAN style="font-size: 13.3333px;"&gt;if(flag_03 = 1, &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;vWeightFlag_03, 0) = 1.5.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I have built my KPI to do this (I'm trying to do this).&lt;/P&gt;&lt;P&gt;My KPI expression to check how many Clients have the sum = 0.25 is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count( distinct {$&amp;lt;[WeightValue] = {"=if(flag_01 = 1, vWeightFlag_01, 0)+if(flag_02 = 1, vWeightFlag_02, 0)+ if(flag_07 = 1, vWeightFlag_07, 0)"} &amp;gt;} ID_Client )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The behavior of this kpi is strange.&lt;/P&gt;&lt;P&gt;It shows me always ZERO, but if I select all the ID client that i know that have 0.25 as sum of flag's weight, it shows me the correct count (for example 3).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to understand why it works only if I make a single or multiple selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jul 2017 14:17:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333981#M95419</guid>
      <dc:creator />
      <dc:date>2017-07-20T14:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333982#M95420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guiseppe,&lt;/P&gt;&lt;P&gt;There are contradictions between your initial post and the latest explanation, plus contradictions within this explanation itself.&amp;nbsp; Not to criticize, but to ask you to upload your application, or better a small example a similar application.&amp;nbsp; Otherwise it is not productive to continue guessing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jul 2017 17:16:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333982#M95420</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-20T17:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis function in a KPI</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333983#M95421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's behaving that way because the KPI does not look at each row, it's an aggregation of all&amp;nbsp; Client_Ids, so it will not work until only a single selection is made. If you were to create a straight table with the Client_Id and the expression, it would work because it's able to evaluate each individual row. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it would be helpful to know what you want in the KPI, my understanding was that you just want a count where the sum of the flags weight = WeightValue. If the weight of each flag is a moving target does that mean that the field WeightValue is also a moving target? I only ask that because if the WeightValue (as you said it's always .25) is static then you would want to ignore any flags &amp;gt; .25 because the combo boxes other than .25 are all greater than .25.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jul 2017 18:59:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/Set-Analysis-function-in-a-KPI/m-p/1333983#M95421</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-20T18:59:15Z</dc:date>
    </item>
  </channel>
</rss>

