<?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: Scripting Help with Total Function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Scripting-Help-with-Total-Function/m-p/443458#M484584</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you prefer in the script, see attached&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Jun 2013 15:49:22 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-06-05T15:49:22Z</dc:date>
    <item>
      <title>Scripting Help with Total Function</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-Help-with-Total-Function/m-p/443456#M484582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two fields, Item and TotalSales2 which are uploaded from a SQL query.&amp;nbsp; &lt;/P&gt;&lt;P&gt;There is only one instance of each Item and the TotalSales2 represents all the sales in the last year for that item.&lt;/P&gt;&lt;P&gt;I use these two values to determine an ABC classification based on cumulative percent sales.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to do this as an expression, but the values change as people filter by other fields.&amp;nbsp; I want the field to be constant.&lt;/P&gt;&lt;P&gt;I think the easiest way to do this is in the script and load the final values.&lt;/P&gt;&lt;P&gt;However, my expression calculation is not working in the script. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please look at what I have an help me write a correct calculation in the script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Script[RollingSales Calculation]&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;If&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;rowno&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;()=1,&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;TotalSales2&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Peek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;RollingSales&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)+&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;TotalSales2&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &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&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;RollingSales &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Expression [Cumulative%Sales]:&amp;nbsp; (A portion of the below calculation, seperated to make the function easier to read)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;RollingSales&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;(&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: #800000; font-size: 8pt;"&gt;TotalSales2&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;SPAN style="font-size: 8pt;"&gt;In Expression [ABC Classification]&lt;/SPAN&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: #800000; font-size: 8pt;"&gt;RollingSales&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;(&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: #800000; font-size: 8pt;"&gt;TotalSales2&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)))&amp;lt;=.8,'A',&lt;/SPAN&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: #800000; font-size: 8pt;"&gt;RollingSales&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;(&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: #800000; font-size: 8pt;"&gt;TotalSales2&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)))&amp;lt;=.95,'B','C')) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;So the ABC classficiation is basically looking at Cumulative % Sales and comparing it to 80% or 95% and assigning values A, B, C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 15:17:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-Help-with-Total-Function/m-p/443456#M484582</guid>
      <dc:creator />
      <dc:date>2013-06-05T15:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Help with Total Function</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-Help-with-Total-Function/m-p/443457#M484583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i hope you serve, used SET Analysis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-size: 8pt; font-family: Arial; color: #800000;"&gt;RollingSales&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 8pt; color: #737373; font-family: Arial;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 8pt; font-family: Arial; color: #0000ff;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 8pt; color: #737373; font-family: Arial;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 8pt; font-family: Arial; color: #0000ff;"&gt;Total&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 8pt; color: #737373; font-family: Arial;"&gt;({&lt;STRONG style="color: #ff0000;"&gt;1&lt;/STRONG&gt;}&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 8pt; font-family: Arial; color: #800000;"&gt;TotalSales2&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 8pt; color: #737373; font-family: Arial;"&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-size: 8pt; color: #737373; font-family: Arial;"&gt;&lt;STRONG style="color: #ff0000; font-size: 11px; font-family: Arial;"&gt;1&lt;/STRONG&gt; ignores the selections&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 15:48:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-Help-with-Total-Function/m-p/443457#M484583</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-06-05T15:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Help with Total Function</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-Help-with-Total-Function/m-p/443458#M484584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you prefer in the script, see attached&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 15:49:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-Help-with-Total-Function/m-p/443458#M484584</guid>
      <dc:creator />
      <dc:date>2013-06-05T15:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Help with Total Function</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-Help-with-Total-Function/m-p/443459#M484585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set analysis was much simplier in this case than I anticipated, so I went with that option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, it actually had to be this: &lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #800000; font-size: 8pt;"&gt;RollingSales&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #737373; font-size: 8pt;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #737373; font-size: 8pt;"&gt;({1}&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #0000ff; font-size: 8pt;"&gt;Total&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #737373; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #800000; font-size: 8pt;"&gt;TotalSales2&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: Arial; color: #737373; font-size: 8pt;"&gt;)), the location of the {1} was off.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 17:03:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-Help-with-Total-Function/m-p/443459#M484585</guid>
      <dc:creator />
      <dc:date>2013-06-05T17:03:40Z</dc:date>
    </item>
  </channel>
</rss>

