<?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: Aggregation expressions required by GROUP BY clause in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggregation-expressions-required-by-GROUP-BY-clause/m-p/1267070#M399057</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you want to use Group by you Need to use an Aggregation function on each field which is not listed after the Group by Statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this link for further Information to Aggregation functions.&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/AggregationFunctions/basic-aggregation-functions.htm" title="https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/AggregationFunctions/basic-aggregation-functions.htm"&gt;https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/AggregationFunctions/basic-aggregation-fun…&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use min/max as you did it in the first left join .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Mar 2017 11:53:01 GMT</pubDate>
    <dc:creator>zhadrakas</dc:creator>
    <dc:date>2017-03-23T11:53:01Z</dc:date>
    <item>
      <title>Aggregation expressions required by GROUP BY clause</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-expressions-required-by-GROUP-BY-clause/m-p/1267067#M399054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the below Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Getting Aggregation Error when i join the Code which is in &lt;STRONG&gt;Bold.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EmpAttendanceLogs:&lt;/P&gt;&lt;P&gt;//Concatenate(EmpAttendance)&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Uniqueid as EmpAttedenceLogID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EmployeeUniqueId as EmpLogUniqueid,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EmployeeUniqueId &amp;amp;Date(Floor(Num(AttendenceDate))) as CompositeKey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EmployeeUniqueId &amp;amp;Date(Floor(Num(AttendenceDate))) as CompositeKey1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ApplyMap('Mapping_Employee',EmployeeUniqueId) as EmployeeAttendenceLogName, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(Floor(Num(AttendenceDate))) as EmpAttendenceLogDate, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AttendenceTime as EmpAttendenceLogTime, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type as LogType, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Status&amp;nbsp; as RegularizedStatus, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IsRegularized&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[..\10_data_sources\EmpAttendanceLogs.qvd]&lt;/P&gt;&lt;P&gt;(qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left Join (EmpAttendanceLogs)&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;EmpLogUniqueid,&lt;/P&gt;&lt;P&gt;EmpAttendenceLogDate,&lt;/P&gt;&lt;P&gt;RegularizedStatus,&lt;/P&gt;&lt;P&gt;Date(Min(EmpAttendenceLogTime),'hh:mm:ss') as RegInTime,&lt;/P&gt;&lt;P&gt;Date(Max(EmpAttendenceLogTime),'hh:mm:ss') as RegOutTime&lt;/P&gt;&lt;P&gt;Resident EmpAttendanceLogs where IsRegularized=1&lt;/P&gt;&lt;P&gt;Group by EmpLogUniqueid,EmpAttendenceLogDate,RegularizedStatus;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left Join (EmpAttendanceLogs)&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;EmpLogUniqueid,&lt;/P&gt;&lt;P&gt;EmpAttendenceLogDate,&lt;/P&gt;&lt;P&gt;RegularizedStatus,&lt;/P&gt;&lt;P&gt;Date(Min(EmpAttendenceLogTime),'hh:mm:ss') as LogInTime,&lt;/P&gt;&lt;P&gt;Date(Max(EmpAttendenceLogTime),'hh:mm:ss') as LogOutTime,&lt;/P&gt;&lt;P&gt;Interval(Date(Max(EmpAttendenceLogTime),'hh:mm:ss')-Date(Min(EmpAttendenceLogTime),'hh:mm:ss') ) as LogDuration&lt;/P&gt;&lt;P&gt;Resident EmpAttendanceLogs where IsRegularized=0&lt;/P&gt;&lt;P&gt;Group by EmpLogUniqueid,EmpAttendenceLogDate,RegularizedStatus;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Left Join (EmpAttendanceLogs)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EmpLogUniqueid,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EmpAttendenceLogDate,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RegularizedStatus,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(Interval(Time(LogInTime,'hh:mm:ss')-Time(RegInTime,'hh:mm:ss'))&amp;gt;0,Interval(Time(LogInTime,'hh:mm:ss')-Time(RegInTime,'hh:mm:ss')),0) as LogInDuration,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(LogOutTime=Time('00:00:00','hh:mm:ss'),Interval(Time(RegOutTime,'hh:mm:ss')-Time(RegInTime,'hh:mm:ss')),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(Interval(Time(RegOutTime,'hh:mm:ss')-Time(LogOutTime,'hh:mm:ss'))&amp;gt;0,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Interval(Time(RegOutTime,'hh:mm:ss')-Time(LogOutTime,'hh:mm:ss')),0)) as LogOutDuration&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident EmpAttendanceLogs&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group by EmpLogUniqueid,EmpAttendenceLogDate,RegularizedStatus;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Getting below error when i join the above code.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Aggregation expressions required by GROUP BY clause&lt;/P&gt;&lt;P&gt;Left Join (EmpAttendanceLogs)&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;EmpLogUniqueid,&lt;/P&gt;&lt;P&gt;EmpAttendenceLogDate,&lt;/P&gt;&lt;P&gt;RegularizedStatus,&lt;/P&gt;&lt;P&gt;If(Interval(Time(LogInTime,'hh:mm:ss')-Time(RegInTime,'hh:mm:ss'))&amp;gt;0,Interval(Time(LogInTime,'hh:mm:ss')-Time(RegInTime,'hh:mm:ss')),0) as LogInDuration,&lt;/P&gt;&lt;P&gt;If(LogOutTime=Time('00:00:00','hh:mm:ss'),Interval(Time(RegOutTime,'hh:mm:ss')-Time(RegInTime,'hh:mm:ss')),&lt;/P&gt;&lt;P&gt;If(Interval(Time(RegOutTime,'hh:mm:ss')-Time(LogOutTime,'hh:mm:ss'))&amp;gt;0,&lt;/P&gt;&lt;P&gt;Interval(Time(RegOutTime,'hh:mm:ss')-Time(LogOutTime,'hh:mm:ss')),0)) as LogOutDuration&lt;/P&gt;&lt;P&gt;Resident EmpAttendanceLogs&lt;/P&gt;&lt;P&gt;Group by EmpLogUniqueid,EmpAttendenceLogDate,RegularizedStatus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Keerthi KS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 10:07:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-expressions-required-by-GROUP-BY-clause/m-p/1267067#M399054</guid>
      <dc:creator />
      <dc:date>2017-03-23T10:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation expressions required by GROUP BY clause</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-expressions-required-by-GROUP-BY-clause/m-p/1267068#M399055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you are using Group by without any Aggregation functions.&lt;/P&gt;&lt;P&gt;try without Group by:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left Join (EmpAttendanceLogs)&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;EmpLogUniqueid,&lt;/P&gt;&lt;P&gt;EmpAttendenceLogDate,&lt;/P&gt;&lt;P&gt;RegularizedStatus,&lt;/P&gt;&lt;P&gt;Date(Min(EmpAttendenceLogTime),'hh:mm:ss') as RegInTime,&lt;/P&gt;&lt;P&gt;Date(Max(EmpAttendenceLogTime),'hh:mm:ss') as RegOutTime&lt;/P&gt;&lt;P&gt;Resident EmpAttendanceLogs where IsRegularized=1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 10:40:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-expressions-required-by-GROUP-BY-clause/m-p/1267068#M399055</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2017-03-23T10:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation expressions required by GROUP BY clause</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-expressions-required-by-GROUP-BY-clause/m-p/1267069#M399056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to have group by function here. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Left Join (EmpAttendanceLogs)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Load&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;EmpLogUniqueid,&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;EmpAttendenceLogDate,&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;RegularizedStatus,&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;If(Interval(Time(LogInTime,'hh:mm:ss')-Time(RegInTime,'hh:mm:ss'))&amp;gt;0,Interval(Time(LogInTime,'hh:mm:ss')-Time(RegInTime,'hh:mm:ss')),0) as LogInDuration,&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;If(LogOutTime=Time('00:00:00','hh:mm:ss'),Interval(Time(RegOutTime,'hh:mm:ss')-Time(RegInTime,'hh:mm:ss')),&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;If(Interval(Time(RegOutTime,'hh:mm:ss')-Time(LogOutTime,'hh:mm:ss'))&amp;gt;0,&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Interval(Time(RegOutTime,'hh:mm:ss')-Time(LogOutTime,'hh:mm:ss')),0)) as LogOutDuration&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Resident EmpAttendanceLogs&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Group by EmpLogUniqueid,EmpAttendenceLogDate,RegularizedStatus;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Can you please tell me what is the mistake here ???&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 11:40:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-expressions-required-by-GROUP-BY-clause/m-p/1267069#M399056</guid>
      <dc:creator />
      <dc:date>2017-03-23T11:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation expressions required by GROUP BY clause</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-expressions-required-by-GROUP-BY-clause/m-p/1267070#M399057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you want to use Group by you Need to use an Aggregation function on each field which is not listed after the Group by Statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this link for further Information to Aggregation functions.&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/AggregationFunctions/basic-aggregation-functions.htm" title="https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/AggregationFunctions/basic-aggregation-functions.htm"&gt;https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/AggregationFunctions/basic-aggregation-fun…&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use min/max as you did it in the first left join .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 11:53:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-expressions-required-by-GROUP-BY-clause/m-p/1267070#M399057</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2017-03-23T11:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation expressions required by GROUP BY clause</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-expressions-required-by-GROUP-BY-clause/m-p/1267071#M399058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let's go back a step and imagine what is going on in the Script Engine's head when it reaches this LOAD statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Time() function accepts only one value as first parameter. For every possible combination of EmpLogUniqueId+EmpAttendanceLogDate+RegularizedStatus, you may get multiple different values in fields LoginTime, LogOutTime, RegInTime and RegOutTime. What should the Time() function do with these multiple values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are sure that only one value is present in all fields, use Only() to simulate the use of an aggregation function, as in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;SPAN style="font-style: inherit; font-size: 13px; font-family: inherit; color: #3d3d3d;"&gt;&lt;STRONG&gt;Interval(Time(Only(RegOutTime),'hh:mm:ss')-Time(Only(RegInTime),'hh:mm:ss'))&lt;/STRONG&gt;&lt;/SPAN&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Min(), Max() or FirstSortedValue() functions can be used to pick a specific datetime value from a series.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 12:02:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-expressions-required-by-GROUP-BY-clause/m-p/1267071#M399058</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2017-03-23T12:02:13Z</dc:date>
    </item>
  </channel>
</rss>

