<?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: Problem with GROUP BY in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430842#M699462</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot. It works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words, it's preferred to make the aggregations in the select part, while using GROUP BY...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Dec 2012 15:36:12 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-12-12T15:36:12Z</dc:date>
    <item>
      <title>Problem with GROUP BY</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430837#M699457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some problem with the GROUP BY clause when loading a script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Week,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Status,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(Amount) AS Sales&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE Week &amp;gt; 10;&lt;/P&gt;&lt;P&gt;SQL SELECT &lt;SPAN style="color: #0000ff;"&gt;*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;FROM DatabaseName.dbo.TableName GROUP BY Week, Status ORDER BY Week;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My error message is that the first column I select (*) is not grouped by or aggregated, as I don't want to load it into my table. On the other hand, if I do...&lt;/P&gt;&lt;P&gt;SELECT Week, Status, Amount&lt;/P&gt;&lt;P&gt;... I won't accomplish this either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;BR /&gt;Filip&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 15:11:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430837#M699457</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-12T15:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with GROUP BY</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430838#M699458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Filip,&lt;/P&gt;&lt;P&gt;This is strictly an SQL problem. You can't select any fields in a GROUP BY query unless they are either part of the GROUP BY list, or aggregated in some function or another (e.g. sum, count, etc). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case, you'd probably want to use SELECT Week, Status, sum(Amount).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, you can load the full data (without a GROUP BY clause) and group it in QV's load statement, but you'll still have to aggregate Amount.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 15:13:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430838#M699458</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2012-12-12T15:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with GROUP BY</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430839#M699459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your quick answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OK, I have managed to accomplish this in an original SQL database manager.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it correct that the problem is that I load and select different things in the script I provided? In "classic SQL" I just have to write...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Week, Status, sum(Amount) As Sales&lt;/P&gt;&lt;P&gt;FROM DatabaseName.dbo.TableName&lt;BR /&gt;GROUP BY Week, Status&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... and I get the result set I want to get.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Can you please give me a code example of a possible solution?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/ Filip&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 15:27:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430839#M699459</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-12T15:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with GROUP BY</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430840#M699460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Week,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sales,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Status;&lt;/P&gt;&lt;P&gt;Select Week, Status, sum(Amount) As Sales&lt;/P&gt;&lt;P&gt;FROM DatabaseName.dbo.TableName&lt;BR /&gt;GROUP BY Week, Status;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 15:29:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430840#M699460</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2012-12-12T15:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with GROUP BY</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430841#M699461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Filip,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have misplaced the group by wrongly. Your script should be&amp;nbsp; like this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Week,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Status,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(Amount) AS Sales&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE Week &amp;gt; 10 &lt;STRONG&gt;group by Week, Status&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL SELECT &lt;SPAN style="color: #0000ff;"&gt;*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;FROM DatabaseName.dbo.TableName ORDER BY Week&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 15:33:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430841#M699461</guid>
      <dc:creator>brindlogcool</dc:creator>
      <dc:date>2012-12-12T15:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with GROUP BY</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430842#M699462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot. It works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words, it's preferred to make the aggregations in the select part, while using GROUP BY...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 15:36:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-GROUP-BY/m-p/430842#M699462</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-12T15:36:12Z</dc:date>
    </item>
  </channel>
</rss>

