<?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: Novice Query - How can I use a distinct count where something equals an 'IF' value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Novice-Query-How-can-I-use-a-distinct-count-where-something/m-p/447150#M487727</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jagan - thank you that works perfectly - much obliged.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jan 2013 16:33:21 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-01-24T16:33:21Z</dc:date>
    <item>
      <title>Novice Query - How can I use a distinct count where something equals an 'IF' value</title>
      <link>https://community.qlik.com/t5/QlikView/Novice-Query-How-can-I-use-a-distinct-count-where-something/m-p/447147#M487724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Apologies I am a novice / self taught user and could do with some help please.&amp;nbsp; I have limited knowledge so if you could spell it out for me that would be very helpful. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/confused.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Scenario&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sales Person A sells a policy to Mrs X.&amp;nbsp; Her Premium value is £1000 (&lt;SPAN style="color: #c00000;"&gt;IntroNP&lt;/SPAN&gt; field)..&amp;nbsp; However because the client was introduced to Sales Person A by Sales Person B, they split the Introducer commission.&amp;nbsp; 75% goes to Sales Person A and 25% goes to Sales person B.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table below shows who should get what.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="padding-left: 5.4pt; padding-right: 5.4pt; border: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;Sales Person&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #00b050;"&gt;Intro_NP&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #00b050;"&gt;Introducer Commission %&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #e36c0a;"&gt;Policy Case Count&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #00b050;"&gt;Introducer Commission&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;Person A&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #00b050;"&gt;£1000&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #00b050;"&gt;75%&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #e36c0a;"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #00b050;"&gt;£37.50&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;Person B&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #00b050;"&gt;£0&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #00b050;"&gt;25%&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #e36c0a;"&gt;0&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="178"&gt;&lt;P&gt;&lt;SPAN style="color: #00b050;"&gt;£12.50&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Working bit.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;These are in my expressions bit.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have managed to create a bit of working script which allocates the premium (&lt;SPAN style="color: #c00000;"&gt;Intro_NP&lt;/SPAN&gt;) ONLY to the person who has an &lt;SPAN style="color: maroon;"&gt;IntroducerCommissionPercentage &lt;/SPAN&gt;value of 75% or higher &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This script below works&amp;nbsp; - in this case Sales Person A gets the credit for the premium £1000 and sales person B gets nothing £0. (see Intro_NP in table above)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;SUM(&lt;/SPAN&gt;&lt;SPAN style="color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: maroon;"&gt;IntroducerCommissionPercentage&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;75,&lt;/SPAN&gt;&lt;SPAN style="color: maroon;"&gt;Intro_NP,0&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #1f497d;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; color: black; text-decoration: underline;"&gt;Problem&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt;I want to do the same with the &lt;SPAN style="text-decoration: underline;"&gt;Policy Case Count&lt;/SPAN&gt; –&amp;nbsp; like the Intro_NP I want to only allocate the case count the sales person who has an &lt;/SPAN&gt;&lt;SPAN style="color: maroon;"&gt;IntroducerCommissionPercentage &lt;/SPAN&gt;of 75% or higher&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: maroon;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Our current policy case count script is below &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: maroon;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: blue;"&gt;count&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: blue;"&gt;distinct&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: maroon;"&gt;description&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;='New Business' &lt;/SPAN&gt;&lt;SPAN style="color: blue;"&gt;or&lt;/SPAN&gt; &lt;SPAN style="color: maroon;"&gt;description&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;='Renewal',&lt;/SPAN&gt;&lt;SPAN style="color: maroon;"&gt;PolicyId&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt;)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt;This script works by itself but i want the distinct count to return a value only where it satisfies the IF Introducer commission value &amp;gt;75.&amp;nbsp; So it looks like the example table above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt;FYI “Description” is the type of transaction and the “PolicyID” is the reference number of the policy.&amp;nbsp; This script currently allocates the count of 1 to both sales person A and sales person B.&amp;nbsp; Only sales person A should get this as a policy count.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt;I am not sure how to combine an&amp;nbsp; IF statement and a distrinct count– please can you help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt;Many Many Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 10:50:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Novice-Query-How-can-I-use-a-distinct-count-where-something/m-p/447147#M487724</guid>
      <dc:creator />
      <dc:date>2013-01-23T10:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Novice Query - How can I use a distinct count where something equals an 'IF' value</title>
      <link>https://community.qlik.com/t5/QlikView/Novice-Query-How-can-I-use-a-distinct-count-where-something/m-p/447148#M487725</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;Perhaps, you can use something like this as your expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=count({&amp;lt;description={'New Business'}+{'Renewal'},IntroducerCommission={'&amp;gt;75'}&amp;gt;}distinct PolicyId)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&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;-Khaled.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 05:14:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Novice-Query-How-can-I-use-a-distinct-count-where-something/m-p/447148#M487725</guid>
      <dc:creator />
      <dc:date>2013-01-24T05:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Novice Query - How can I use a distinct count where something equals an 'IF' value</title>
      <link>https://community.qlik.com/t5/QlikView/Novice-Query-How-can-I-use-a-distinct-count-where-something/m-p/447149#M487726</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;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=count({&amp;lt;description={'New Business', 'Renewal'},IntroducerCommission={'&amp;gt;75'}&amp;gt;}distinct PolicyId)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 06:07:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Novice-Query-How-can-I-use-a-distinct-count-where-something/m-p/447149#M487726</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2013-01-24T06:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Novice Query - How can I use a distinct count where something equals an 'IF' value</title>
      <link>https://community.qlik.com/t5/QlikView/Novice-Query-How-can-I-use-a-distinct-count-where-something/m-p/447150#M487727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jagan - thank you that works perfectly - much obliged.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 16:33:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Novice-Query-How-can-I-use-a-distinct-count-where-something/m-p/447150#M487727</guid>
      <dc:creator />
      <dc:date>2013-01-24T16:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Novice Query - How can I use a distinct count where something equals an 'IF' value</title>
      <link>https://community.qlik.com/t5/QlikView/Novice-Query-How-can-I-use-a-distinct-count-where-something/m-p/447151#M487728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many Thanks Khaled&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 16:39:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Novice-Query-How-can-I-use-a-distinct-count-where-something/m-p/447151#M487728</guid>
      <dc:creator />
      <dc:date>2013-01-24T16:39:47Z</dc:date>
    </item>
  </channel>
</rss>

