<?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: Average calculation at the script level in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728200#M723998</link>
    <description>&lt;P&gt;you can o something like below&lt;/P&gt;&lt;P&gt;MAIN:&lt;BR /&gt;LOAD BR_CODE, ME_CODE, NAME_1, POLI_NO, V_NO, RECEIPT_NO, NAME_2, AMOUNT, VOUCHER_NO&lt;BR /&gt;FROM [D:\COMM_DETAILS.xlsx] (ooxml, embedded labels, table is WORKING);&lt;/P&gt;&lt;P&gt;LEFT JOIN (MAIN)&lt;BR /&gt;LOAD [Branch Code], BRANCH, [ME Code] AS ME_CODE,Sales_Person_Name, [Date Joined], Designation, Premium,&lt;BR /&gt;&lt;STRONG&gt;((year(today())*12)+month(today())) - (((year([Date Joined])*12)+month([Date Joined]))) as Age_in_month,&lt;/STRONG&gt;&lt;BR /&gt;Ceded_Premium, Ceded_Comm, [Net Revenue], Commission, [Net Claims], [Gross Profit],&lt;BR /&gt;[Staff Cost], [Other Cost], [Net Contribution], [Debtors &amp;amp; Rtd Cheques over 90 Days], Salary,&lt;BR /&gt;EPF, ETF, Gratuity, Bonus, Medical, Insurance, [Special Allowance], Telephone, Fuel,&lt;BR /&gt;[Vehicle Maintenence], Insurance1, Depreciation, [Lease Cost], F32, [Resigned Date], F34, F35,&lt;BR /&gt;F36, F37, F38&lt;BR /&gt;FROM [D:\DATE_JOINED.xlsx] (ooxml, embedded labels, table is D_J);&lt;/P&gt;&lt;P&gt;LEFT JOIN (MAIN)&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;BR_CODE,ME_CODE,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SUM(AMOUNT)/Age_in_month AS AVG_COMM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;RESIDENT MAIN&lt;/P&gt;&lt;P&gt;GROUP BY ME_CODE,BR_CODE;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jul 2020 20:50:52 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2020-07-15T20:50:52Z</dc:date>
    <item>
      <title>Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1727429#M723989</link>
      <description>&lt;P&gt;Dear All!&lt;/P&gt;&lt;P&gt;Appreciate, if I'm helped with, to calculate average at the script level so that I need to be able to write a nested if statement to prepare a class&amp;nbsp; like (&amp;gt;30000, 20000-30000,10000-20000 ) etc ,based on the average computed at the script level. Since the value given is not the average the class function to be based on the average. Also, the average here should be the half of the value of each employee.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Neville&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1727429#M723989</guid>
      <dc:creator>nevilledhamsiri</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1727638#M723990</link>
      <description>Load the data normally in the script, then, using the key field or fields, LEFT JOIN another table with the aggregation for the average, something like&lt;BR /&gt;&lt;BR /&gt;LEFT JOIN (Table) LOAD&lt;BR /&gt;EmployeeID,&lt;BR /&gt;Avg(Value) AS AvgValue, // if this value needs to be divided by two, do it here&lt;BR /&gt;Class(Avg(Value), 'Class1', 'Class2', Class3') AS ClassValue&lt;BR /&gt;RESIDENT Table;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Jul 2020 11:04:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1727638#M723990</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2020-07-14T11:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1727781#M723991</link>
      <description>&lt;P&gt;Dear Migual,&lt;/P&gt;&lt;P&gt;Could you please see any synthetic error in my if statement at the script? I do not get it correctly at the back end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 19:07:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1727781#M723991</guid>
      <dc:creator>nevilledhamsiri</dc:creator>
      <dc:date>2020-07-14T19:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1727817#M723992</link>
      <description>&lt;P&gt;change like below&lt;/P&gt;&lt;P&gt;MAIN:&lt;BR /&gt;LOAD BR_CODE, DATE, ME_NAME, VALUE&lt;/P&gt;&lt;P&gt;FROM [D:\ME_COMM.xlsx] (ooxml, embedded labels, table is Sheet1);&lt;/P&gt;&lt;P&gt;LEFT JOIN (MAIN)&lt;BR /&gt;LOAD&lt;BR /&gt;ME_NAME,BR_CODE,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;avg(VALUE)&lt;/STRONG&gt; AS AVGVALUE,&lt;BR /&gt;IF(&lt;STRONG&gt;avg(VALUE)&lt;/STRONG&gt;&amp;gt;25000,'&amp;gt;25000',&lt;BR /&gt;IF(&lt;STRONG&gt;avg(VALUE)&lt;/STRONG&gt;&amp;gt;20000,'20000-25000',&lt;BR /&gt;IF(&lt;STRONG&gt;avg(VALUE)&lt;/STRONG&gt;&amp;gt;15000,'15000-20000',&lt;BR /&gt;IF(&lt;STRONG&gt;avg(VALUE)&lt;/STRONG&gt;&amp;gt;10000,'10000-15000','&amp;lt;10000'))))AS CLASS_FLAG&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;RESIDENT MAIN&lt;BR /&gt;&lt;STRONG&gt;Group by ME_NAME,BR_CODE;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 21:34:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1727817#M723992</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-14T21:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728148#M723993</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Kush,&lt;/P&gt;&lt;P&gt;It worked. I need to be more thorough in script writing familiarity. Suppose I have two files where one file carry commissions details of employees &amp;amp; other carry their date joined. I need to calculate the average commissions based on the employee's age. If the age is &amp;gt;= 12 Months as at today, the amount to be the average of twelve Months if not the amount to be divided by number of Months which may be less than 12 Months. How the script to be structured like you did it for a situation only when a single table is loaded which is the base table.I did it to some far but getting a script error. Could you please help me on this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Neville&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 17:22:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728148#M723993</guid>
      <dc:creator>nevilledhamsiri</dc:creator>
      <dc:date>2020-07-15T17:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728151#M723994</link>
      <description>&lt;P&gt;Dear Miguel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply which helped me to gain some idea to further my interest on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Neville&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 17:34:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728151#M723994</guid>
      <dc:creator>nevilledhamsiri</dc:creator>
      <dc:date>2020-07-15T17:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728153#M723995</link>
      <description>&lt;P&gt;Do you need just for 12 months Avg or dynamic like if some employee completed 6 months so avg of 6 months?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 17:39:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728153#M723995</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-15T17:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728155#M723996</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes,&lt;/P&gt;&lt;P&gt;but it should be at the script itself&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 17:44:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728155#M723996</guid>
      <dc:creator>nevilledhamsiri</dc:creator>
      <dc:date>2020-07-15T17:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728156#M723997</link>
      <description>&lt;P&gt;Should be varied depending on the age (Months) like you said to be dynamic&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 17:46:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728156#M723997</guid>
      <dc:creator>nevilledhamsiri</dc:creator>
      <dc:date>2020-07-15T17:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728200#M723998</link>
      <description>&lt;P&gt;you can o something like below&lt;/P&gt;&lt;P&gt;MAIN:&lt;BR /&gt;LOAD BR_CODE, ME_CODE, NAME_1, POLI_NO, V_NO, RECEIPT_NO, NAME_2, AMOUNT, VOUCHER_NO&lt;BR /&gt;FROM [D:\COMM_DETAILS.xlsx] (ooxml, embedded labels, table is WORKING);&lt;/P&gt;&lt;P&gt;LEFT JOIN (MAIN)&lt;BR /&gt;LOAD [Branch Code], BRANCH, [ME Code] AS ME_CODE,Sales_Person_Name, [Date Joined], Designation, Premium,&lt;BR /&gt;&lt;STRONG&gt;((year(today())*12)+month(today())) - (((year([Date Joined])*12)+month([Date Joined]))) as Age_in_month,&lt;/STRONG&gt;&lt;BR /&gt;Ceded_Premium, Ceded_Comm, [Net Revenue], Commission, [Net Claims], [Gross Profit],&lt;BR /&gt;[Staff Cost], [Other Cost], [Net Contribution], [Debtors &amp;amp; Rtd Cheques over 90 Days], Salary,&lt;BR /&gt;EPF, ETF, Gratuity, Bonus, Medical, Insurance, [Special Allowance], Telephone, Fuel,&lt;BR /&gt;[Vehicle Maintenence], Insurance1, Depreciation, [Lease Cost], F32, [Resigned Date], F34, F35,&lt;BR /&gt;F36, F37, F38&lt;BR /&gt;FROM [D:\DATE_JOINED.xlsx] (ooxml, embedded labels, table is D_J);&lt;/P&gt;&lt;P&gt;LEFT JOIN (MAIN)&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;BR_CODE,ME_CODE,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SUM(AMOUNT)/Age_in_month AS AVG_COMM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;RESIDENT MAIN&lt;/P&gt;&lt;P&gt;GROUP BY ME_CODE,BR_CODE;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 20:50:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728200#M723998</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-15T20:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728235#M723999</link>
      <description>&lt;P&gt;Dear Kush&lt;/P&gt;&lt;P&gt;Your script structure was applied &amp;amp; it is almost there but following script error coming while data is loaded. Please see what may causes this error?&lt;/P&gt;&lt;P&gt;Thanks for the reply&lt;/P&gt;&lt;P&gt;Invalid expression&lt;BR /&gt;LEFT JOIN (MAIN)&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;BR_CODE,ME_CODE,&lt;/P&gt;&lt;P&gt;SUM(AMOUNT)/Age_in_month AS AVG_COMM&lt;/P&gt;&lt;P&gt;RESIDENT MAIN&lt;/P&gt;&lt;P&gt;GROUP BY ME_CODE,BR_CODE&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 01:39:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728235#M723999</guid>
      <dc:creator>nevilledhamsiri</dc:creator>
      <dc:date>2020-07-16T01:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728540#M724000</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Kush,&lt;/P&gt;&lt;P&gt;Following error comes when the data are loaded. Could you please refer this &amp;amp; see what the error is? I tried to locate but no idea where it is connected with. 90% must be ok&amp;nbsp; as the age calculation is happening as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Neville&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invalid expression&lt;BR /&gt;LEFT JOIN (MAIN)&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;BR_CODE,ME_CODE,&lt;/P&gt;&lt;P&gt;SUM(AMOUNT)/Age_in_month AS AVG_COMM&lt;/P&gt;&lt;P&gt;RESIDENT MAIN&lt;/P&gt;&lt;P&gt;GROUP BY ME_CODE,BR_CODE&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 16:34:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728540#M724000</guid>
      <dc:creator>nevilledhamsiri</dc:creator>
      <dc:date>2020-07-16T16:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728560#M724001</link>
      <description>&lt;P&gt;change below&lt;/P&gt;&lt;P&gt;LEFT JOIN (MAIN)&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;BR_CODE,ME_CODE,&lt;/P&gt;&lt;P&gt;SUM(AMOUNT)/max(Age_in_month) AS AVG_COMM&lt;/P&gt;&lt;P&gt;RESIDENT MAIN&lt;/P&gt;&lt;P&gt;GROUP BY ME_CODE,BR_CODE&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 17:43:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728560#M724001</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-16T17:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728573#M724002</link>
      <description>&lt;P&gt;Yet to encounter the same script error what I have noted earlier though the adjustment was done as you proposed.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 18:08:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728573#M724002</guid>
      <dc:creator>nevilledhamsiri</dc:creator>
      <dc:date>2020-07-16T18:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation at the script level</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728579#M724003</link>
      <description>&lt;P&gt;can you share script?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 18:18:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-at-the-script-level/m-p/1728579#M724003</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-16T18:18:19Z</dc:date>
    </item>
  </channel>
</rss>

