<?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: KPI not giving me sum for the current month. in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/KPI-not-giving-me-sum-for-the-current-month/m-p/1789391#M61672</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/136883"&gt;@Binay_Sharma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;InMonth("Cycle End Date", [As Of Date] , 0) * -1 AS _CMTD_Flag,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;instead of above,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LET vMaxDate = Num(Today()-1); // assign the max date based on ur requirement&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;InMonthToDate("Cycle End Date",$(vMaxDate),0) * -1 as _CMTD_Flag,&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Mar 2021 02:06:52 GMT</pubDate>
    <dc:creator>MayilVahanan</dc:creator>
    <dc:date>2021-03-09T02:06:52Z</dc:date>
    <item>
      <title>KPI not giving me sum for the current month.</title>
      <link>https://community.qlik.com/t5/App-Development/KPI-not-giving-me-sum-for-the-current-month/m-p/1789385#M61671</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am just a beginner and I am looking for help in set operators using conditional flag.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a simple star schema (I have provided the model image below). I have generated the master colander for deterring current month and previous month flags.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a measure called &lt;STRONG&gt;#uvGrossFee&lt;/STRONG&gt;, which I need to sum up for the current month to display as KPI for the current month.&lt;/P&gt;&lt;P&gt;I am using set operators as follows:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;sum({$&amp;lt; _CMTD_Flag ={1} &amp;gt;} [#uvGross Fee] )&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;-- This is summing up and giving me total for the entire months. I am looking for the summation of gross fees for the current month only.&amp;nbsp; Please note I am using this as KPI and I don't want its value to be changed with any dimension selection from any filter pane (for now, i have not used any filter pane).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I even tried this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum({$&amp;lt; asofdate=, _CMTD_Flag ={1} &amp;gt;} [#uvGross Fee] )&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please advise what I am missing here?&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Setoperator.jpg" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/50676iB55150B87DD293D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Setoperator.jpg" alt="Setoperator.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the model I have developed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Binay_Sharma_0-1615251329670.png" style="width: 300px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/50675i5E25E8CF0ACF6910/image-dimensions/300x171?v=v2" width="300" height="171" role="button" title="Binay_Sharma_0-1615251329670.png" alt="Binay_Sharma_0-1615251329670.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;/*** Below is the script I have used for developing Mater Table **/ Source "QlikView Your Business"&lt;/P&gt;&lt;P&gt;Temp_Dates:&lt;BR /&gt;LOAD&lt;BR /&gt;FieldValue('Cycle End Date', RecNo()) as "Cycle End Date"&lt;BR /&gt;AutoGenerate&lt;BR /&gt;FieldValueCount('Cycle End Date')&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Join (Temp_Dates)&lt;BR /&gt;load&lt;BR /&gt;&lt;BR /&gt;Date(floor(MonthEnd(AddMonths(MinDate, IterNo() -1)))) as [As Of Date]&lt;BR /&gt;WHILE&lt;BR /&gt;Date(floor(MonthEnd(AddMonths(MinDate, IterNo() -1)))) &amp;lt;= Date(floor(MonthEnd(MaxDate)))&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;load&lt;BR /&gt;Date(floor(MonthEnd(Min("Cycle End Date")))) as MinDate,&lt;BR /&gt;Date(floor(MonthEnd(Max("Cycle End Date")))) as MaxDate&lt;BR /&gt;resident&lt;BR /&gt;Temp_Dates&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;AsOfDate:&lt;BR /&gt;load&lt;BR /&gt;"Cycle End Date",&lt;BR /&gt;[As Of Date] ,&lt;BR /&gt;Year([As Of Date] ) AS Year,&lt;BR /&gt;Month([As Of Date] ) AS Month,&lt;BR /&gt;'Q' &amp;amp; ceil(month([As Of Date] ) / 3) AS Quarter,&lt;BR /&gt;Year([As Of Date] ) &amp;amp;'-'&amp;amp; 'Q' &amp;amp; ceil(month([As Of Date] ) / 3)&lt;BR /&gt;AS QuarterYear,&lt;/P&gt;&lt;P&gt;Date([As Of Date] , 'MMM-YYYY') AS MonthYear,&lt;/P&gt;&lt;P&gt;InMonth("Cycle End Date", [As Of Date] , 0) * -1 AS _CMTD_Flag,&lt;BR /&gt;InMonth("Cycle End Date", [As Of Date] , -12) * -1 AS _PMTD_Flag,&lt;BR /&gt;InMonth("Cycle End Date", [As Of Date] , -1) * -1 AS _PM_Flag,&lt;/P&gt;&lt;P&gt;InYearToDate("Cycle End Date", [As Of Date] , 0) * -1 AS _CYTD_Flag,&lt;BR /&gt;InYearToDate("Cycle End Date", [As Of Date] , -1) * -1 AS _PYTD_Flag,&lt;BR /&gt;(AddMonths("Cycle End Date", 12) &amp;gt; [As Of Date] ) * -1 AS _R12_Flag,&lt;BR /&gt;(AddMonths("Cycle End Date", 12) &amp;lt;= [As Of Date] ) *&lt;BR /&gt;(AddMonths("Cycle End Date", 24) &amp;gt; [As Of Date] ) AS _PR12_Flag,&lt;/P&gt;&lt;P&gt;(AddMonths("Cycle End Date", 6) &amp;gt; [As Of Date] ) * -1 AS _R6_Flag,&lt;/P&gt;&lt;P&gt;(AddMonths("Cycle End Date", 6) &amp;lt;= [As Of Date] ) *&lt;BR /&gt;(AddMonths("Cycle End Date", 12) &amp;gt; [As Of Date] ) AS _PR6_Flag,&lt;/P&gt;&lt;P&gt;(AddMonths("Cycle End Date", 12) &amp;lt;= [As Of Date] ) *&lt;BR /&gt;(AddMonths("Cycle End Date", 18) &amp;gt; [As Of Date] ) AS _PYR6_Flag,&lt;/P&gt;&lt;P&gt;(AddMonths("Cycle End Date", 3) &amp;gt; [As Of Date] ) * -1 AS _R3_Flag,&lt;/P&gt;&lt;P&gt;(AddMonths("Cycle End Date", 3) &amp;lt;= [As Of Date] ) *&lt;BR /&gt;(AddMonths("Cycle End Date", 6) &amp;gt; [As Of Date] ) AS _PR3_Flag,&lt;/P&gt;&lt;P&gt;(AddMonths("Cycle End Date", 12) &amp;lt;= [As Of Date] ) *&lt;BR /&gt;(AddMonths("Cycle End Date", 15) &amp;gt; [As Of Date] ) AS _PYR3_Flag&lt;/P&gt;&lt;P&gt;resident&lt;BR /&gt;Temp_Dates&lt;BR /&gt;where&lt;BR /&gt;"Cycle End Date"&amp;lt;=[As Of Date]&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;drop table Temp_Dates;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 01:10:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/KPI-not-giving-me-sum-for-the-current-month/m-p/1789385#M61671</guid>
      <dc:creator>Binay_Sharma</dc:creator>
      <dc:date>2021-03-09T01:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: KPI not giving me sum for the current month.</title>
      <link>https://community.qlik.com/t5/App-Development/KPI-not-giving-me-sum-for-the-current-month/m-p/1789391#M61672</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/136883"&gt;@Binay_Sharma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;InMonth("Cycle End Date", [As Of Date] , 0) * -1 AS _CMTD_Flag,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;instead of above,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LET vMaxDate = Num(Today()-1); // assign the max date based on ur requirement&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;InMonthToDate("Cycle End Date",$(vMaxDate),0) * -1 as _CMTD_Flag,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 02:06:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/KPI-not-giving-me-sum-for-the-current-month/m-p/1789391#M61672</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2021-03-09T02:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: KPI not giving me sum for the current month.</title>
      <link>https://community.qlik.com/t5/App-Development/KPI-not-giving-me-sum-for-the-current-month/m-p/1789394#M61674</link>
      <description>&lt;P&gt;Hi Mayil,&lt;/P&gt;&lt;P&gt;Thanks for getting back to me. But, I cant use vMaxDate as Today() because I want to have flexibility in data load. For example, I might load the data only till December 2020 instead of February 2021. In such case current month should be December 2020 not February 2020.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like no matter what, I need to use the As of Date from Filter Pane. On that basis only the KPI will work for that given month.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if you think otherwise.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;Binay&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 02:48:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/KPI-not-giving-me-sum-for-the-current-month/m-p/1789394#M61674</guid>
      <dc:creator>Binay_Sharma</dc:creator>
      <dc:date>2021-03-09T02:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: KPI not giving me sum for the current month.</title>
      <link>https://community.qlik.com/t5/App-Development/KPI-not-giving-me-sum-for-the-current-month/m-p/1789398#M61675</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/136883"&gt;@Binay_Sharma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try like below&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum({$&amp;lt; &lt;SPAN&gt;[As Of Date]&amp;nbsp;&lt;/SPAN&gt;={"&amp;gt;=$(=date(MonthStart(Max(&lt;SPAN&gt;[As Of Date])&lt;/SPAN&gt;,0),'DD/MM/YYYY'))&amp;lt;=$(=Date(MonthEnd(Max(&lt;SPAN&gt;[As Of Date]&lt;/SPAN&gt;),0),'DD/MM/YYYY'))"} &amp;gt;} [#uvGross Fee] )&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 02:55:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/KPI-not-giving-me-sum-for-the-current-month/m-p/1789398#M61675</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2021-03-09T02:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: KPI not giving me sum for the current month.</title>
      <link>https://community.qlik.com/t5/App-Development/KPI-not-giving-me-sum-for-the-current-month/m-p/1789591#M61694</link>
      <description>&lt;P&gt;This approach should work. Let me try.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 13:00:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/KPI-not-giving-me-sum-for-the-current-month/m-p/1789591#M61694</guid>
      <dc:creator>Binay_Sharma</dc:creator>
      <dc:date>2021-03-09T13:00:05Z</dc:date>
    </item>
  </channel>
</rss>

