<?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: Avg count with If condition in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Avg-count-with-If-condition/m-p/1322599#M409564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please close the thread by marking Stefan's response as correct response&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-14806"&gt;Qlik Community Tip: Marking Replies as Correct or Helpful&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 May 2017 18:37:43 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2017-05-23T18:37:43Z</dc:date>
    <item>
      <title>Avg count with If condition</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-count-with-If-condition/m-p/1322595#M409560</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 am very new to Qlik and looking to resolve the below problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to calculate the average number of shifts per employee for employees who have done more than 5 shifts by Type.&lt;/P&gt;&lt;P&gt;Table is as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StaffID,Type,HoursWorked&lt;/P&gt;&lt;P&gt;1,A,5&lt;/P&gt;&lt;P&gt;1,A,7&lt;/P&gt;&lt;P&gt;1,A,3&lt;/P&gt;&lt;P&gt;2,A,4&lt;/P&gt;&lt;P&gt;2,A,5&lt;/P&gt;&lt;P&gt;3,B,1&lt;/P&gt;&lt;P&gt;3,B,5&lt;/P&gt;&lt;P&gt;3,B,10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get an average number of shifts per staff I used the below expression:&lt;/P&gt;&lt;P&gt;Avg(Aggr(Count(HoursWorked),StaffID))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get number of staff who worked more than 5 shifts: &lt;/P&gt;&lt;P&gt;Count(if(Aggr(count(HoursWorked),StaffID)&amp;gt;5,StaffID))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And to get the average count of shifts for staff with count &amp;gt; 5 the below:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Avg(&lt;/SPAN&gt;Aggr&lt;SPAN style="font-size: 13.3333px;"&gt;(count(&lt;SPAN style="font-size: 13.3333px;"&gt;if(Aggr(count(HoursWorked),StaffID)&amp;gt;5,StaffID)&lt;/SPAN&gt;),StaffID))&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;but it does not work.&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;Any help will be highly appreciated.&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;Thanks,&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;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 May 2017 17:52:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-count-with-If-condition/m-p/1322595#M409560</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-05-23T17:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Avg count with If condition</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-count-with-If-condition/m-p/1322596#M409561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe&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;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;Avg(&lt;/SPAN&gt;Aggr&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;(count(&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;if( count(HoursWorked)&amp;gt;5,count(HoursWorked) ),StaffID))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;edit: True, Sunny, it should look like&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;Avg( &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Aggr&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;if( count(HoursWorked)&amp;gt;5,count(HoursWorked) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit; font-size: 13.3333px; font-style: inherit; font-weight: inherit;"&gt; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,StaffID)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 May 2017 18:03:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-count-with-If-condition/m-p/1322596#M409561</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2017-05-23T18:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Avg count with If condition</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-count-with-If-condition/m-p/1322597#M409562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might have left an extra count in there.... Count(If(Count......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 May 2017 18:07:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-count-with-If-condition/m-p/1322597#M409562</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-05-23T18:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Avg count with If condition</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-count-with-If-condition/m-p/1322598#M409563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It worked, thank you so much Stefan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leszek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 May 2017 18:12:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-count-with-If-condition/m-p/1322598#M409563</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-05-23T18:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Avg count with If condition</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-count-with-If-condition/m-p/1322599#M409564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please close the thread by marking Stefan's response as correct response&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-14806"&gt;Qlik Community Tip: Marking Replies as Correct or Helpful&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 May 2017 18:37:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-count-with-If-condition/m-p/1322599#M409564</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-05-23T18:37:43Z</dc:date>
    </item>
  </channel>
</rss>

