<?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: Convert Straight Table to an Aggregated Table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720074#M451792</link>
    <description>&lt;P&gt;You can also do this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum(If(Category = 'Consumption' and [Actual Quantity] = 0, 0,
If(Category = 'Production', Null(),
If(ProducedMaterialGroupCode = '90014' or NoCostFlag = 1 or ProducedMaterialCode = '2280249', 0, RangeSum([Theoretical Requirement], [Actual Quantity])))))&lt;/LI-CODE&gt;&lt;P&gt;or just create a flag in the script if possible (i.e. if all the fields are located in a single table)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD *,
If(Category = 'Consumption' and [Actual Quantity] = 0, 0,
If(Category = 'Production', Null(),
If(ProducedMaterialGroupCode = '90014' or NoCostFlag = 1 or ProducedMaterialCode = '2280249', 0, 1) as CalcFlag&lt;/LI-CODE&gt;&lt;P&gt;and then this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum({&amp;lt;CalcFlag = {1}&amp;gt;} RangeSum([Theoretical Requirement], [Actual Quantity]))&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 18 Jun 2020 16:43:29 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2020-06-18T16:43:29Z</dc:date>
    <item>
      <title>Convert Straight Table to an Aggregated Table</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720059#M451789</link>
      <description>&lt;P&gt;Hello, everyone.&lt;/P&gt;&lt;P&gt;My problem is this:&lt;/P&gt;&lt;P&gt;I have created a really large straight table with many dimensions (many of them calculated) and many expressions.&lt;/P&gt;&lt;P&gt;This table works more like an Excel table rather than a QlikView straight table.&lt;/P&gt;&lt;P&gt;The expressions rely heavily on the other columns through references and there is a lot of business logic in them (if this then that or...).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nevertheless the numbers are ok and business aproves them and now they want me to create the same table on company level by year and month... and it seems that i cannot make the numbers be correct in the new table...&lt;/P&gt;&lt;P&gt;The expression that bugs me most is this&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;=If(Category='Consumption' and [Actual Quantity]=0,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;if(Category='Production',&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Null(),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;if(ProducedMaterialGroupCode='90014' or NoCostFlag=1 or ProducedMaterialCode='2280249',&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;[Theoretical Requirement]+[Actual Quantity]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;where&amp;nbsp;&lt;FONT face="courier new,courier"&gt;[Theoretical Requirement]&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;and&lt;/FONT&gt;[Actual Quantity]&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;are other columns of the table.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it helps what i want to do is shown below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/35801i6D0966A1249BC215/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 00:27:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720059#M451789</guid>
      <dc:creator>dapostolopoylos</dc:creator>
      <dc:date>2024-11-16T00:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Straight Table to an Aggregated Table</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720069#M451790</link>
      <description>&lt;P&gt;May be try&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=Sum(Aggr(Sum({&amp;lt;Category-={'Consumption', 'Production'},[Actual Quantity]-={0},ProducedMaterialGroupCode={'90014'}, NoCostFlag-={1} , ProducedMaterialCode-={'2280249'}&amp;gt;}[Theoretical Requirement]+[Actual Quantity]), Company_Code))&lt;/LI-CODE&gt;&lt;P&gt;If this doesn't work, I would share your qvw for people to look at your calculated dimensions.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 16:03:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720069#M451790</guid>
      <dc:creator>vamsee</dc:creator>
      <dc:date>2020-06-18T16:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Straight Table to an Aggregated Table</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720073#M451791</link>
      <description>&lt;P&gt;Thank you for your reply but it doesn't work...&lt;/P&gt;&lt;P&gt;Theroretical Requirement is itself calculated and i cannot exclude both 'Consumption' and 'Production' from Category, these are all the values of the field...&lt;/P&gt;&lt;P&gt;Nevertheless, thank you, i wlli play around a little with your central idea of Aggr&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 16:39:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720073#M451791</guid>
      <dc:creator>dapostolopoylos</dc:creator>
      <dc:date>2020-06-18T16:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Straight Table to an Aggregated Table</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720074#M451792</link>
      <description>&lt;P&gt;You can also do this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum(If(Category = 'Consumption' and [Actual Quantity] = 0, 0,
If(Category = 'Production', Null(),
If(ProducedMaterialGroupCode = '90014' or NoCostFlag = 1 or ProducedMaterialCode = '2280249', 0, RangeSum([Theoretical Requirement], [Actual Quantity])))))&lt;/LI-CODE&gt;&lt;P&gt;or just create a flag in the script if possible (i.e. if all the fields are located in a single table)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD *,
If(Category = 'Consumption' and [Actual Quantity] = 0, 0,
If(Category = 'Production', Null(),
If(ProducedMaterialGroupCode = '90014' or NoCostFlag = 1 or ProducedMaterialCode = '2280249', 0, 1) as CalcFlag&lt;/LI-CODE&gt;&lt;P&gt;and then this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum({&amp;lt;CalcFlag = {1}&amp;gt;} RangeSum([Theoretical Requirement], [Actual Quantity]))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 18 Jun 2020 16:43:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720074#M451792</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-06-18T16:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Straight Table to an Aggregated Table</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720257#M451798</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the first sol;utiom you provided but unforunately it didn't&amp;nbsp; work...&lt;/P&gt;&lt;P&gt;I remind you that [Theroretical Requirement] and [Actual Quantity] are expression columns that i don't want them to be show in my aggregated new chart.&lt;/P&gt;&lt;P&gt;To make more clear what i am talking about, i'm attaching a sample qvw that contains the actual table i already created and the aggregated one that i want to get right...&lt;/P&gt;&lt;P&gt;I hope it will help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 07:39:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720257#M451798</guid>
      <dc:creator>dapostolopoylos</dc:creator>
      <dc:date>2020-06-19T07:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Straight Table to an Aggregated Table</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720370#M451801</link>
      <description>&lt;P&gt;May be this for Jan&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum({&amp;lt;PostingMonth = {1}&amp;gt;}Aggr(
If(Category='Consumption' and Sum(Quantity)=0,
	0,
	if(Category='Production',
			Null(),
			if(ProducedMaterialGroupCode='90014' or NoCostFlag=1 or ProducedMaterialCode='2280249',
				0,
				(If(Category='Consumption' and Sum(Quantity)=0,
	0,
	if(Category='Consumption' and MaterialCodeGroup='21',
		Qty101_102,
		(([BOM Requirement]/BaseQuantity)*Qty101_102)
	)
))+Sum(Quantity)
			   )
   )
)
,PostingMonth,ProductionOrder,ComponentCode, ProducedMaterial, ProductionBatch, Component, Category))&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 19 Jun 2020 14:14:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720370#M451801</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-06-19T14:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Straight Table to an Aggregated Table</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720408#M451805</link>
      <description>&lt;P&gt;Thank you so much for your effort&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;There are 8 material categories in my data model and your expression works perfectly for the 6 of them.&lt;/P&gt;&lt;P&gt;Is there a chance that you might take a look on those two left behind also?&lt;/P&gt;&lt;P&gt;I am attaching another sample file with data from those 2 categories (Packaging Materials, Additional Materials)&lt;/P&gt;&lt;P&gt;Thank you again!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 15:25:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1720408#M451805</guid>
      <dc:creator>dapostolopoylos</dc:creator>
      <dc:date>2020-06-19T15:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Straight Table to an Aggregated Table</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1721082#M451824</link>
      <description>&lt;P&gt;No luck with that&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;?&lt;/P&gt;&lt;P&gt;Maybe,&amp;nbsp;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22245"&gt;@swuehl&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/18624"&gt;@Gysbert_Wassenaar&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22949"&gt;@tresB&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/13367"&gt;@alexandros17&lt;/a&gt;&amp;nbsp;, do you have any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 06:20:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1721082#M451824</guid>
      <dc:creator>dapostolopoylos</dc:creator>
      <dc:date>2020-06-23T06:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Straight Table to an Aggregated Table</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1726080#M452020</link>
      <description>&lt;P&gt;You may find the following Design Blog useful in relation to the use of AGGR in Set Analysis:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Set-Analysis-in-the-Aggr-function/ba-p/1463822" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/Set-Analysis-in-the-Aggr-function/ba-p/1463822&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 12:28:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1726080#M452020</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2020-07-08T12:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Straight Table to an Aggregated Table</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1726167#M452034</link>
      <description>&lt;P&gt;Thank you for response, it's funny but today i finally figured it out!&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;guided me to the right path and the only addition to his solution, according to the sample(3).qvw file is the following&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Sum({&amp;lt;PostingMonth = {1}&amp;gt;}Aggr(
If(Category='Consumption' and Sum(Quantity)=0,
	0,
	if(Category='Production',
			Null(),
			if(ProducedMaterialGroupCode='90014' or NoCostFlag=1 or ProducedMaterialCode='2280249',
				0,
				(If(Category='Consumption' and Sum(Quantity)=0,
	0,
	if(Category='Consumption' and MaterialCodeGroup='21',
		Qty101_102,
		(([BOM Requirement]/BaseQuantity)*Qty101_102)
	)
))+Sum(Quantity)
			   )
   )
)
,PostingMonth,ProductionOrder,ComponentCode, ProducedMaterial, ProductionBatch, Component, Category,Plant,StorLoc))&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Just added the last two dimension (Plant, StorLoc) in the Aggr function and everything worked!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 15:20:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-Straight-Table-to-an-Aggregated-Table/m-p/1726167#M452034</guid>
      <dc:creator>dapostolopoylos</dc:creator>
      <dc:date>2020-07-08T15:20:42Z</dc:date>
    </item>
  </channel>
</rss>

