<?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 HELP! how to use an IF condition inside a count measure KPI in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/HELP-how-to-use-an-IF-condition-inside-a-count-measure-KPI/m-p/2004816#M83164</link>
    <description>&lt;P&gt;Hi friends,&lt;/P&gt;
&lt;P&gt;I am trying to include and If condition inside a count measure&lt;/P&gt;
&lt;P&gt;Can you please give me your opinion?&lt;/P&gt;
&lt;P&gt;The count that I have built is:&lt;/P&gt;
&lt;P&gt;Count( distinct {&amp;lt;[GSDP.termstartdate_vp.autoCalendar.Year],[GSDP.termstartdate_vp.autoCalendar.Month],&lt;BR /&gt;CRM.servicetype={'Optional'},CRM.I_CMPGN={'9098'},CRM.contact_date ={"&amp;lt;=$(Date(Max(CRM.termstartdate)))"} &amp;gt;} VIN_)&lt;/P&gt;
&lt;P&gt;This KPI represents the count of Users (VIN_) filtered by some features as CRM.servicetype and I_CMPGN, the Issue is that the campaign '9098' was launched on Jun the 3rd of 2022, so when I select for example the month May 2022 this KPI should be showing 0 counts, I have added that set analysis CRM.contact_date ={"&amp;lt;=$(Date(Max(CRM.termstartdate)))"} but is not working, I have a fact table requested by the client, where I have applied a measure that makes what I am looking for, and is this:&lt;/P&gt;
&lt;P&gt;=if(CRM.contact_date=aggr(max(if(CRM.contact_date &amp;lt;= CRM.termstartdate,CRM.contact_date)),VIN_),CRM.OFFER_VERSION_DESC1)&lt;/P&gt;
&lt;P&gt;This measure is correctly showing for example when filtering on May 2022 that the count on the table is 0, I am trying to introduce this on the KPI measure but I don't get how to do that, the closest built I have is&lt;/P&gt;
&lt;P&gt;Count( distinct {&amp;lt;[GSDP.termstartdate_vp.autoCalendar.Year],[GSDP.termstartdate_vp.autoCalendar.Month],&lt;BR /&gt;CRM.servicetype={'Optional'},CRM.I_CMPGN={'9098'},CRM.contact_date =(if(CRM.contact_date=aggr(max(if(CRM.contact_date &amp;lt;= CRM.termstartdate,CRM.contact_date))))) &amp;gt;} VIN_)&lt;/P&gt;
&lt;P&gt;I clarify that the CRM.OFFER_VERSION_DESC1 field is the field contains all the campaign names launched, is a similar than the column I_CMPGN,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thank you if there is any light from you&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;</description>
    <pubDate>Tue, 15 Nov 2022 15:27:06 GMT</pubDate>
    <dc:creator>FelipeK16</dc:creator>
    <dc:date>2022-11-15T15:27:06Z</dc:date>
    <item>
      <title>HELP! how to use an IF condition inside a count measure KPI</title>
      <link>https://community.qlik.com/t5/App-Development/HELP-how-to-use-an-IF-condition-inside-a-count-measure-KPI/m-p/2004816#M83164</link>
      <description>&lt;P&gt;Hi friends,&lt;/P&gt;
&lt;P&gt;I am trying to include and If condition inside a count measure&lt;/P&gt;
&lt;P&gt;Can you please give me your opinion?&lt;/P&gt;
&lt;P&gt;The count that I have built is:&lt;/P&gt;
&lt;P&gt;Count( distinct {&amp;lt;[GSDP.termstartdate_vp.autoCalendar.Year],[GSDP.termstartdate_vp.autoCalendar.Month],&lt;BR /&gt;CRM.servicetype={'Optional'},CRM.I_CMPGN={'9098'},CRM.contact_date ={"&amp;lt;=$(Date(Max(CRM.termstartdate)))"} &amp;gt;} VIN_)&lt;/P&gt;
&lt;P&gt;This KPI represents the count of Users (VIN_) filtered by some features as CRM.servicetype and I_CMPGN, the Issue is that the campaign '9098' was launched on Jun the 3rd of 2022, so when I select for example the month May 2022 this KPI should be showing 0 counts, I have added that set analysis CRM.contact_date ={"&amp;lt;=$(Date(Max(CRM.termstartdate)))"} but is not working, I have a fact table requested by the client, where I have applied a measure that makes what I am looking for, and is this:&lt;/P&gt;
&lt;P&gt;=if(CRM.contact_date=aggr(max(if(CRM.contact_date &amp;lt;= CRM.termstartdate,CRM.contact_date)),VIN_),CRM.OFFER_VERSION_DESC1)&lt;/P&gt;
&lt;P&gt;This measure is correctly showing for example when filtering on May 2022 that the count on the table is 0, I am trying to introduce this on the KPI measure but I don't get how to do that, the closest built I have is&lt;/P&gt;
&lt;P&gt;Count( distinct {&amp;lt;[GSDP.termstartdate_vp.autoCalendar.Year],[GSDP.termstartdate_vp.autoCalendar.Month],&lt;BR /&gt;CRM.servicetype={'Optional'},CRM.I_CMPGN={'9098'},CRM.contact_date =(if(CRM.contact_date=aggr(max(if(CRM.contact_date &amp;lt;= CRM.termstartdate,CRM.contact_date))))) &amp;gt;} VIN_)&lt;/P&gt;
&lt;P&gt;I clarify that the CRM.OFFER_VERSION_DESC1 field is the field contains all the campaign names launched, is a similar than the column I_CMPGN,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thank you if there is any light from you&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 15:27:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/HELP-how-to-use-an-IF-condition-inside-a-count-measure-KPI/m-p/2004816#M83164</guid>
      <dc:creator>FelipeK16</dc:creator>
      <dc:date>2022-11-15T15:27:06Z</dc:date>
    </item>
  </channel>
</rss>

