<?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 Error using sum and count together with Group By in Qlik script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Error-using-sum-and-count-together-with-Group-By-in-Qlik-script/m-p/37116#M2533</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;My problem is that I want to calculate unique users per day from a userlogfile "cacore.EnvUsersLog" and save this value in a new field "UUniqueUser"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My sqript is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;// User Log&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;LOAD "UserId" as UUserId,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LoginDate as ULoginDate,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year(LoginDate) as UYear,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Week(LoginDate) as UWeek,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dual( Year(LoginDate) &amp;amp; '-' &amp;amp; Week(LoginDate), num(Year(LoginDate)) &amp;amp; num(Week(LoginDate), '00' )) as UYearWeek,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(1=1,'Portal') as UType,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dual( Year(LoginDate) &amp;amp; '-' &amp;amp; Month(LoginDate), num(Year(LoginDate)) &amp;amp; num(Month(LoginDate), '00' )) as UYearMonth,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp; &lt;EM&gt; &lt;SPAN style="color: #ff0000;"&gt;Sum(Count("UserId")) as UUniqueUser&lt;/SPAN&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 13.3333px;"&gt;&lt;EM&gt;&amp;nbsp; Group By LoginDate;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;SQL SELECT *FROM "myloc_PROD_220".cacore.EnvUsersLog;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;I got the following error message&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: monospace; font-size: 13px;"&gt;Error in expression: Nested aggregation not allowed : LOAD "UserId" as UUserId, LoginDate as ULoginDate, Year(LoginDate) as UYear, Week(LoginDate) as UWeek, dual( Year(LoginDate) &amp;amp; '-' &amp;amp; Week(LoginDate), num(Year(LoginDate)) &amp;amp; num(Week(LoginDate), '00' )) as UYearWeek, If(1=1,'Portal') as UType, dual( Year(LoginDate) &amp;amp; '-' &amp;amp; Month(LoginDate), num(Year(LoginDate)) &amp;amp; num(Month(LoginDate), '00' )) as UYearMonth, Sum(Count("UserId")) as UUniqueUser Group By LoginDate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: monospace; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;What am i doing wrong?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;// Magnus&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Dec 2021 15:42:54 GMT</pubDate>
    <dc:creator>magnusrydberg</dc:creator>
    <dc:date>2021-12-22T15:42:54Z</dc:date>
    <item>
      <title>Error using sum and count together with Group By in Qlik script</title>
      <link>https://community.qlik.com/t5/App-Development/Error-using-sum-and-count-together-with-Group-By-in-Qlik-script/m-p/37116#M2533</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;My problem is that I want to calculate unique users per day from a userlogfile "cacore.EnvUsersLog" and save this value in a new field "UUniqueUser"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My sqript is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;// User Log&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;LOAD "UserId" as UUserId,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LoginDate as ULoginDate,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year(LoginDate) as UYear,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Week(LoginDate) as UWeek,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dual( Year(LoginDate) &amp;amp; '-' &amp;amp; Week(LoginDate), num(Year(LoginDate)) &amp;amp; num(Week(LoginDate), '00' )) as UYearWeek,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(1=1,'Portal') as UType,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dual( Year(LoginDate) &amp;amp; '-' &amp;amp; Month(LoginDate), num(Year(LoginDate)) &amp;amp; num(Month(LoginDate), '00' )) as UYearMonth,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp; &lt;EM&gt; &lt;SPAN style="color: #ff0000;"&gt;Sum(Count("UserId")) as UUniqueUser&lt;/SPAN&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 13.3333px;"&gt;&lt;EM&gt;&amp;nbsp; Group By LoginDate;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;SQL SELECT *FROM "myloc_PROD_220".cacore.EnvUsersLog;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;I got the following error message&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: monospace; font-size: 13px;"&gt;Error in expression: Nested aggregation not allowed : LOAD "UserId" as UUserId, LoginDate as ULoginDate, Year(LoginDate) as UYear, Week(LoginDate) as UWeek, dual( Year(LoginDate) &amp;amp; '-' &amp;amp; Week(LoginDate), num(Year(LoginDate)) &amp;amp; num(Week(LoginDate), '00' )) as UYearWeek, If(1=1,'Portal') as UType, dual( Year(LoginDate) &amp;amp; '-' &amp;amp; Month(LoginDate), num(Year(LoginDate)) &amp;amp; num(Month(LoginDate), '00' )) as UYearMonth, Sum(Count("UserId")) as UUniqueUser Group By LoginDate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-family: monospace; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;What am i doing wrong?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;// Magnus&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2021 15:42:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Error-using-sum-and-count-together-with-Group-By-in-Qlik-script/m-p/37116#M2533</guid>
      <dc:creator>magnusrydberg</dc:creator>
      <dc:date>2021-12-22T15:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error using sum and count together with Group By in Qlik script</title>
      <link>https://community.qlik.com/t5/App-Development/Error-using-sum-and-count-together-with-Group-By-in-Qlik-script/m-p/37117#M2534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you acn't use nested aggregation like &lt;/P&gt;&lt;P&gt;&lt;EM style="color: #ff0000; font-size: 13.3333px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;Sum(Count("UserId")) as UUniqueUser&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #ff0000; font-size: 13.3333px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #ff0000; font-size: 13.3333px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;instead just use &lt;EM style="color: #ff0000; font-size: 13.3333px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;Count("UserId") you can sum it up in frontend.&lt;/EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 10:07:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Error-using-sum-and-count-together-with-Group-By-in-Qlik-script/m-p/37117#M2534</guid>
      <dc:creator>poojashribanger</dc:creator>
      <dc:date>2018-05-31T10:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Error using sum and count together with Group By in Qlik script</title>
      <link>https://community.qlik.com/t5/App-Development/Error-using-sum-and-count-together-with-Group-By-in-Qlik-script/m-p/37118#M2535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot! Sometimes it's more easier then you expect &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 10:18:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Error-using-sum-and-count-together-with-Group-By-in-Qlik-script/m-p/37118#M2535</guid>
      <dc:creator>magnusrydberg</dc:creator>
      <dc:date>2018-05-31T10:18:35Z</dc:date>
    </item>
  </channel>
</rss>

