<?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: How to calculate monthly average in a table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-calculate-monthly-average-in-a-table/m-p/12197#M779276</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry.I cant.&lt;/P&gt;&lt;P&gt;Just give me an idea is it possible to calculate by using avg function?&lt;/P&gt;&lt;P&gt;I have calculated by calculating max -min date.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Apr 2018 13:58:39 GMT</pubDate>
    <dc:creator>anindya_manna</dc:creator>
    <dc:date>2018-04-10T13:58:39Z</dc:date>
    <item>
      <title>How to calculate monthly average in a table</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-calculate-monthly-average-in-a-table/m-p/12195#M779274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Hello Experts,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"&gt;I have a table given below.I want to calculate average six month sales before campaign start date.Below expression did not give correct result.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"&gt;avg({$&amp;lt;[Process Date]={"&amp;gt;=$(=date(addmonths(CAMPAIGN_START_DATE,-6),'M/D/YYYY')) &amp;lt;$(=date(CAMPAIGN_START_DATE,'M/D/YYYY'))"&amp;gt;}[Sales Amt])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"&gt;Here avg function working such a way like sum(sales amt)/count(sales amt).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"&gt;But I want avg monthly sales using avg function like sum(sales amt)/no of months.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"&gt;In the below table for agent 111 total sales is 1500 before six months of &lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;CAMPAIGN_START_DATE.no of months will be between 11/11/2017 to 01/01/2018. i.e. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;(20+31+1)=52days/30.42=1.70(as 365 days a year so 365/12=30.42)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;now avg monthly sales will be 1500/1.70=882.352.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;I want like that.any idea how to do that using avg() function.&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"&gt;Process Date, CAMPAIGN_START_DATE, Sales Amt, Agent ID &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"&gt;1/1/2018, 2/1/2018 12:00:00 AM, 500, 111 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;12/12/2017, 2/1/2018 12:00:00 AM, 500, 111 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;11/11/2017, 2/1/2018 12:00:00 AM, 500, 111 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;3/3/2018, 2/1/2018 12:00:00 AM, 400, 111 &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-calculate-monthly-average-in-a-table/m-p/12195#M779274</guid>
      <dc:creator>anindya_manna</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate monthly average in a table</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-calculate-monthly-average-in-a-table/m-p/12196#M779275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you share the app?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2018 13:54:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-calculate-monthly-average-in-a-table/m-p/12196#M779275</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-10T13:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate monthly average in a table</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-calculate-monthly-average-in-a-table/m-p/12197#M779276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry.I cant.&lt;/P&gt;&lt;P&gt;Just give me an idea is it possible to calculate by using avg function?&lt;/P&gt;&lt;P&gt;I have calculated by calculating max -min date.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2018 13:58:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-calculate-monthly-average-in-a-table/m-p/12197#M779276</guid>
      <dc:creator>anindya_manna</dc:creator>
      <dc:date>2018-04-10T13:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate monthly average in a table</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-calculate-monthly-average-in-a-table/m-p/12198#M779277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be try this? Created based on your sample data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Previous1:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;LOAD&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; *, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Floor&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Date#&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ProcessDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 'M/D/YYYY')) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AS&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ProcessDtID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Floor&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Date#&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CAMPAIGN_START_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 'M/D/YYYY hh:mm:ss ttt'), 'M/D/YYYY')) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AS&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CampaignDtID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Date#&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CAMPAIGN_START_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 'M/D/YYYY hh:mm:ss ttt'), 'M/D/YYYY') &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AS&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CampaignStartDt&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;INLINE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[&lt;BR /&gt; ProcessDate, CAMPAIGN_START_DATE, Sales, Agent ID &lt;BR /&gt; 1/1/2018, 2/1/2018 12:00:00 AM, 500, 111 &lt;BR /&gt; 12/12/2017, 2/1/2018 12:00:00 AM, 500, 111 &lt;BR /&gt; 11/11/2017, 2/1/2018 12:00:00 AM, 500, 111 &lt;BR /&gt; 3/3/2018, 2/1/2018 12:00:00 AM, 400, 111 &lt;BR /&gt; ]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Use this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;I used a variable to calculate number of days between those 6months.&amp;nbsp; vNoOfDays&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;so create a variable using Ctrl+Alt+V then add a variable with below formula.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Interval&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MAX&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ProcessDtID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;gt;=$(=Floor(AddMonths(Date(Max(CampaignDtID)), -6)))&amp;lt;= $(=Max(CampaignDtID))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;} &amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ProcessDtID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) -&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MIN&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ProcessDtID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;gt;=$(=Floor(AddMonths(Date(Max(CampaignDtID)), -6)))&amp;lt;= $(=Max(CampaignDtID))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;} &amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ProcessDtID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), 'dd')&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actual Expression:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;= Num&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ProcessDtID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;gt;=$(=Floor(AddMonths(Date(Max(CampaignDtID)), -6)))&amp;lt;=$(=Max(CampaignDtID))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;} &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)/&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Ceil&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;vNoOfDays&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;/(365/12), '0.05'), '#,##0.00') &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;IMG class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/199117_pastedImage_13.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2018 14:31:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-calculate-monthly-average-in-a-table/m-p/12198#M779277</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2018-04-10T14:31:27Z</dc:date>
    </item>
  </channel>
</rss>

