<?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 Treat null as 0 in LINST_M calculation in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Treat-null-as-0-in-LINST-M-calculation/m-p/1126204#M370656</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Qlikkers!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to get the LINST_M of the count of unique values across a set of buckets. There are cases where a bucket will be empty&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 3 ways to handle the empty bucket. Here they are using exel for simplification&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Ignore the missing bucket.&lt;/P&gt;&lt;P&gt;This is what Qlik gives as the equation when adding the trendline on a bar chart unless I tell it to show all dimensions .&amp;nbsp; It's not what I want as it ignores bucket 4&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-4" src="https://community.qlik.com/legacyfs/online/130803_pastedImage_23.png" style="max-height: 900px; max-width: 1200px;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Include the bucket with no values, but with a value of null. Not what I want either.&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/130796_pastedImage_3.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Include the the bucket with a value of 0.&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/130798_pastedImage_5.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the third option. Because the expression is a count, it should treat nothing (null) as zero. I can get the correct value by displaying the expression when adding the trend line, but I cannot get the same value as an expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This expression gives me the second option&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;LINEST_M&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;AnalysisSeparator&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {'x'}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;UniqueID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Salesman&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Bucket&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Bucket&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Can anyone assist in getting the LINST_M calculation to treat the empty bucket as 0?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried putting in a rangesum, an if, a len, but no joy. (I probably just have a parenthesis in the wrong place))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A sample QVW is attached which shows the problem for salesperson Fred.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Running Qlikview 11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Jul 2016 03:26:07 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-07-11T03:26:07Z</dc:date>
    <item>
      <title>Treat null as 0 in LINST_M calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Treat-null-as-0-in-LINST-M-calculation/m-p/1126204#M370656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Qlikkers!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to get the LINST_M of the count of unique values across a set of buckets. There are cases where a bucket will be empty&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 3 ways to handle the empty bucket. Here they are using exel for simplification&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Ignore the missing bucket.&lt;/P&gt;&lt;P&gt;This is what Qlik gives as the equation when adding the trendline on a bar chart unless I tell it to show all dimensions .&amp;nbsp; It's not what I want as it ignores bucket 4&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-4" src="https://community.qlik.com/legacyfs/online/130803_pastedImage_23.png" style="max-height: 900px; max-width: 1200px;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Include the bucket with no values, but with a value of null. Not what I want either.&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/130796_pastedImage_3.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Include the the bucket with a value of 0.&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/130798_pastedImage_5.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the third option. Because the expression is a count, it should treat nothing (null) as zero. I can get the correct value by displaying the expression when adding the trend line, but I cannot get the same value as an expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This expression gives me the second option&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;LINEST_M&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;AnalysisSeparator&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {'x'}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;UniqueID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Salesman&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Bucket&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Bucket&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Can anyone assist in getting the LINST_M calculation to treat the empty bucket as 0?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried putting in a rangesum, an if, a len, but no joy. (I probably just have a parenthesis in the wrong place))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A sample QVW is attached which shows the problem for salesperson Fred.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Running Qlikview 11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2016 03:26:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Treat-null-as-0-in-LINST-M-calculation/m-p/1126204#M370656</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-11T03:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Treat null as 0 in LINST_M calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Treat-null-as-0-in-LINST-M-calculation/m-p/1126205#M370657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christopher,&lt;/P&gt;&lt;P&gt;Did you manage to find a solition?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2017 14:29:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Treat-null-as-0-in-LINST-M-calculation/m-p/1126205#M370657</guid>
      <dc:creator />
      <dc:date>2017-06-20T14:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Treat null as 0 in LINST_M calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Treat-null-as-0-in-LINST-M-calculation/m-p/1126206#M370658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/people/tomsharkbelarus"&gt;tomsharkbelarus&lt;/A&gt;‌ -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One solution in the above sample case could be to use something like this&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=LINEST_M(Aggr(RangeSum(Count({&amp;lt;AnalysisSeparator = {'x'}&amp;gt;}UniqueID), Avg({&amp;lt;AnalysisSeparator = {'y'}&amp;gt;} 0)), Salesman, Bucket), Bucket)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in the above case we got lucky that there is a Bucket available for &lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;AnalysisSeparator = y&lt;/STRONG&gt;&lt;/SPAN&gt;, but if you don't have that, you will unfortunately modify your script to get at least a row for Salesman and Bucket. Because if the row doesn't exists, Aggr() won't pick it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2017 16:29:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Treat-null-as-0-in-LINST-M-calculation/m-p/1126206#M370658</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-06-20T16:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Treat null as 0 in LINST_M calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Treat-null-as-0-in-LINST-M-calculation/m-p/1126207#M370659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my particular case I have even not the pairs (y=transactions, x=dates) at all, but I need them to build a valid trend in QlikSense chart and table for each and every article of goods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is another old solution, I found here &lt;A href="https://community.qlik.com/message/677438"&gt;Re: linest_m problem&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't like this but I add "zero transactions" in script for filling gaps: several hundred articles of goods at several hundred days in master calendar.....not a lot for Qlik.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2017 05:51:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Treat-null-as-0-in-LINST-M-calculation/m-p/1126207#M370659</guid>
      <dc:creator />
      <dc:date>2017-06-21T05:51:12Z</dc:date>
    </item>
  </channel>
</rss>

