<?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: Calculate average pr month in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378096#M494992</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Summary:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;sum(Sales) / count({&amp;lt;Customer, Product&amp;gt;} &lt;STRONG&gt;total &lt;/STRONG&gt;distinct Month)&lt;/EM&gt;&lt;UL&gt;&lt;LI&gt;remember to include all dimensions except Month inside &amp;lt;&amp;gt;.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;sum(Sales) / &lt;/EM&gt;if(IsNull(GetFieldSelections(Month)),count({1} total distinct Month),(substringcount(GetFieldSelections(Month,';'),';')+1))&lt;UL&gt;&lt;LI&gt;gives the correct result without having to specify all other dimensions. But is rather messy. Any suggestions for a simple expressions without specifying all other dimensions is appreciated.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks to swuehl for helpful ﻿contribution!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Tom Arne&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Aug 2012 06:45:15 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-08-21T06:45:15Z</dc:date>
    <item>
      <title>Calculate average pr month</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378086#M494982</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;I want to visualise sales pr customer. One of the dimensions is year/month. To make the data comparable regardless of number of month in selection, I want to visualise the sales expressions as $/month. I've tried with sum(Sales)/count(distinct year_month), which almost gives me what I want. The problem is that if there were no sales to a customer a month, the count excludes that month, which I don't want it to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I want to do someting like:&lt;/P&gt;&lt;P&gt;sum(Sales)/count(year_month "selected in year_month list box")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions how to implement this expression?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tom Arne Sivertsen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 09:58:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378086#M494982</guid>
      <dc:creator />
      <dc:date>2012-08-15T09:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average pr month</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378087#M494983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=sum(Sales) / GetSelectedCount( year_month )&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 10:18:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378087#M494983</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-08-15T10:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average pr month</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378088#M494984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, it helps a bit, but I see I was a little inaccurate in my description. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GetSelectedCount( year_month ) seems to return "active" selections (those green selections). But if GetSelectedCount( year_month ) = 0 (no date active selections are done), I need to get the count of the full span of dates in the list box (both white and grey).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition to that, I see that if I first choose months Jan, Feb &amp;amp; Mar (3 months), and then a customer without sales for e.g. Feb, GetSelectedCount( year_month ) returns 2, but I want 3 (just as the current selections box shows in this example (please see attached screen shot).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas of further functions to utilize?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tom Arne&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="20224" class="jive-image-thumbnail jive-image" onclick="" alt="CustomerSales.jpg" src="https://community.qlik.com/legacyfs/online/20224_CustomerSales.jpg" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 10:58:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378088#M494984</guid>
      <dc:creator />
      <dc:date>2012-08-15T10:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average pr month</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378089#M494985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=sum(Sales) / count({&amp;lt;Customer&amp;gt;} distinct Month)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll need to add all fields that might limit the Month selections in the set expression, comma separated, e.g. with an additional Product:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=sum(Sales) / count({&amp;lt;Customer, Product&amp;gt;} distinct Month)&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 11:24:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378089#M494985</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-08-15T11:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average pr month</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378090#M494986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using "&lt;EM&gt;=sum(Sales) / count({&amp;lt;Customer&amp;gt;} distinct Month)", &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;it still returns 2 instead of 3 in my test app (with only month and customer as dimensions). Can I upload my example somewhere for you to have a look in what I mean?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Tom Arne&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 12:00:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378090#M494986</guid>
      <dc:creator />
      <dc:date>2012-08-15T12:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average pr month</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378091#M494987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, sure, I forgot that Customer is / could be a dimension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Upload is available from the advanced editor (link in editor in upper right corner, should be default when editing an existing post).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: and try&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=sum(Sales) / count({&amp;lt;Customer, Product&amp;gt;} &lt;STRONG&gt;total &lt;/STRONG&gt;distinct Month)&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 12:03:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378091#M494987</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-08-15T12:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average pr month</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378092#M494988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have uploaded now ☺&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 12:04:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378092#M494988</guid>
      <dc:creator />
      <dc:date>2012-08-15T12:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average pr month</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378093#M494989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! Now I get the correct numbers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But do I need to specify the dimension(s)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=sum(Sales) / count({1} &lt;STRONG&gt;total &lt;/STRONG&gt;distinct Month) &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seems also to return my expected number as well (and should be more robust...). Do you see any drawback by specifying {1} instead of the dimensions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tom Arne&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2012 06:48:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378093#M494989</guid>
      <dc:creator />
      <dc:date>2012-08-16T06:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average pr month</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378094#M494990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, it depends on your needs, {1} could be &lt;EM&gt;too &lt;/EM&gt;robust. What if you select only Jan and Feb (two months)? &lt;/P&gt;&lt;P&gt;Do you then want your denominator to return 2 or 3 in your sample?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2012 09:01:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378094#M494990</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-08-16T09:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average pr month</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378095#M494991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see your point. I want 2 in that example, so {1} will be wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I played a little around and came up with this messy version utilizing the function GetFieldSelections together with count {1} total:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style=": ; font-size: 1;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;IsNull&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;GetFieldSelections&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Month&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)),&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({1} &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;total&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Month&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;substringcount&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;GetFieldSelections&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Month&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;,';'),';')+1)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems to me to return the correct result without having to specify all possible dimensions. I'll give the two versions a try when my app evolves forward. Please let me know if you see a simpler way to calculate this without specifying all other dimensions than month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Tom Arne&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2012 10:20:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378095#M494991</guid>
      <dc:creator />
      <dc:date>2012-08-16T10:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average pr month</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378096#M494992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Summary:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;sum(Sales) / count({&amp;lt;Customer, Product&amp;gt;} &lt;STRONG&gt;total &lt;/STRONG&gt;distinct Month)&lt;/EM&gt;&lt;UL&gt;&lt;LI&gt;remember to include all dimensions except Month inside &amp;lt;&amp;gt;.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;sum(Sales) / &lt;/EM&gt;if(IsNull(GetFieldSelections(Month)),count({1} total distinct Month),(substringcount(GetFieldSelections(Month,';'),';')+1))&lt;UL&gt;&lt;LI&gt;gives the correct result without having to specify all other dimensions. But is rather messy. Any suggestions for a simple expressions without specifying all other dimensions is appreciated.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks to swuehl for helpful ﻿contribution!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Tom Arne&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Aug 2012 06:45:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-average-pr-month/m-p/378096#M494992</guid>
      <dc:creator />
      <dc:date>2012-08-21T06:45:15Z</dc:date>
    </item>
  </channel>
</rss>

