<?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 Redistribution of values during script load in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Redistribution-of-values-during-script-load/m-p/206653#M62693</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have the following situation:&lt;/P&gt;&lt;P&gt;1 table, Structure, with Year/Month, BrickCode, Product, Value&lt;/P&gt;&lt;P&gt;1 table, Data, with BrickCode, BrickName, New_Brick, SalesRep_Surname&lt;/P&gt;&lt;P&gt;As you can see in the attached files the New_Brick is defined only for some BrickName and not all bricks related to a SalesRep are groupped in the New_Brick. i.e SalesRep = Rogers as 13 Bricks but only 4 in the New_Brick.&lt;/P&gt;&lt;P&gt;What i need is to distribute the full amount of New_Brick equally to all SalesRep in the New_Brick group.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;For istance full amount of MILANO (New_Brick) is 1.200 where Rogers makes 400 €, Lucas makes 700 € and Coppola makes 100 €.&lt;/P&gt;&lt;P&gt;I need to have the 1.200 € divided equally to the 3 reps: Rogers 400€, Lucas 400 € and Coppola 400 € but in fact they have different number of bricks: Rogers as 4 bricks, Lucas and Coppola 8.&lt;/P&gt;&lt;P&gt;After some test I have defined that I need to recalculate the amount made for each single line in the Data table where:&lt;/P&gt;&lt;P&gt;If New_Brick is null I use Value, if is not null (Milano, Torino, Napoli) I need to divede the full amount for New_Brick (1200) by the number of reps in this macro area (3) and divide the result by the number of records existing in Data table.&lt;/P&gt;&lt;P&gt;i.e if Rogers as 4 bricks in the New_Brick Milano I need to count how many records I have in the table Dati for these bricks (100). Now the formula is 1200 / 3 = 400 / 100 = 4.&lt;/P&gt;&lt;P&gt;Lucas as 200 lines so the formula is 1200 / 3 = 400 / 200 = 2 and Coppola as 150 lines so 1200 / 3 = 400 / 50 = 8.&lt;/P&gt;&lt;P&gt;Finally I have that each line of Rogers as a "new" value of 4, Lucas of 2 and Coppola 8. The full amount is the same but I have redistributed the values equally to the reps in the Milano area.&lt;/P&gt;&lt;P&gt;How to do it in QlikView?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Sep 2010 14:32:20 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-09-17T14:32:20Z</dc:date>
    <item>
      <title>Redistribution of values during script load</title>
      <link>https://community.qlik.com/t5/QlikView/Redistribution-of-values-during-script-load/m-p/206653#M62693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have the following situation:&lt;/P&gt;&lt;P&gt;1 table, Structure, with Year/Month, BrickCode, Product, Value&lt;/P&gt;&lt;P&gt;1 table, Data, with BrickCode, BrickName, New_Brick, SalesRep_Surname&lt;/P&gt;&lt;P&gt;As you can see in the attached files the New_Brick is defined only for some BrickName and not all bricks related to a SalesRep are groupped in the New_Brick. i.e SalesRep = Rogers as 13 Bricks but only 4 in the New_Brick.&lt;/P&gt;&lt;P&gt;What i need is to distribute the full amount of New_Brick equally to all SalesRep in the New_Brick group.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;For istance full amount of MILANO (New_Brick) is 1.200 where Rogers makes 400 €, Lucas makes 700 € and Coppola makes 100 €.&lt;/P&gt;&lt;P&gt;I need to have the 1.200 € divided equally to the 3 reps: Rogers 400€, Lucas 400 € and Coppola 400 € but in fact they have different number of bricks: Rogers as 4 bricks, Lucas and Coppola 8.&lt;/P&gt;&lt;P&gt;After some test I have defined that I need to recalculate the amount made for each single line in the Data table where:&lt;/P&gt;&lt;P&gt;If New_Brick is null I use Value, if is not null (Milano, Torino, Napoli) I need to divede the full amount for New_Brick (1200) by the number of reps in this macro area (3) and divide the result by the number of records existing in Data table.&lt;/P&gt;&lt;P&gt;i.e if Rogers as 4 bricks in the New_Brick Milano I need to count how many records I have in the table Dati for these bricks (100). Now the formula is 1200 / 3 = 400 / 100 = 4.&lt;/P&gt;&lt;P&gt;Lucas as 200 lines so the formula is 1200 / 3 = 400 / 200 = 2 and Coppola as 150 lines so 1200 / 3 = 400 / 50 = 8.&lt;/P&gt;&lt;P&gt;Finally I have that each line of Rogers as a "new" value of 4, Lucas of 2 and Coppola 8. The full amount is the same but I have redistributed the values equally to the reps in the Milano area.&lt;/P&gt;&lt;P&gt;How to do it in QlikView?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Sep 2010 14:32:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Redistribution-of-values-during-script-load/m-p/206653#M62693</guid>
      <dc:creator />
      <dc:date>2010-09-17T14:32:20Z</dc:date>
    </item>
  </channel>
</rss>

