<?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: Calculate scores bases on recent answer in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897301#M1012733</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your response. I tried the expression and it works but the problem is the consistency. It does not select the recent response if a subject has multiple questions and these questions received multiple answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the example I have attached, the response to question 1 is recent for Subject B, but in case of subject C, it is incorrect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Apr 2015 15:45:02 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-04-24T15:45:02Z</dc:date>
    <item>
      <title>Calculate scores bases on recent answer</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897296#M1012728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my data looks as shown below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Subject&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Question&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Timestamp&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Score&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;03/20/2015 7:07:21 PM&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;03/20/2015 7:06:31 PM&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;03/20/2015 7:06:16 PM&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;03/20/2015 7:05:59 PM&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;03/20/2015 7:05:40 PM&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;03/20/2015 7:05:02 PM&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically a subject can have several questions, but there should be only one answer considered per question. If there were multiple answers recorded, we take the most recent response. The aim is to calculate the average score for each subject and display it in bar graph.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subject A should say (3+4)/2 =3.5&amp;nbsp; Subject B should say (5+5+6)/3 = 5.33. However what is currently happening is subject B says (5+3+5+6)/4 and this is not correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to figure a way to not consider the row 4. I would also like to do it in the expressions and not disturb the data model as it is complex and this is just an example. Any help ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My current expression says avg(score) with Subject as dimension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2015 17:36:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897296#M1012728</guid>
      <dc:creator />
      <dc:date>2015-04-23T17:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate scores bases on recent answer</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897297#M1012729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Subject, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Question, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Timestamp, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Score&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2003" data-containertype="14" data-objectid="161497" data-objecttype="1" href="https://community.qlik.com/thread/161497"&gt;https://community.qlik.com/thread/161497&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Subject,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Question,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; FirstSortedValue(Score, -Timestamp) as Score,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; FirstSortedValue(Timestamp, -Timestamp) as TimeStamp&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group By Subject, Question;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2015 17:44:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897297#M1012729</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-04-23T17:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate scores bases on recent answer</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897298#M1012730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also find attached the sample app.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2015 17:45:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897298#M1012730</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-04-23T17:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate scores bases on recent answer</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897299#M1012731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to do it in the expression?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2015 17:45:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897299#M1012731</guid>
      <dc:creator />
      <dc:date>2015-04-23T17:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate scores bases on recent answer</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897300#M1012732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the following expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Avg(If(Aggr(FirstSortedValue(Question, -Timestamp), Subject, Question) = Aggr(Question, Subject, Question), Score))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2015 17:50:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897300#M1012732</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-04-23T17:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate scores bases on recent answer</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897301#M1012733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your response. I tried the expression and it works but the problem is the consistency. It does not select the recent response if a subject has multiple questions and these questions received multiple answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the example I have attached, the response to question 1 is recent for Subject B, but in case of subject C, it is incorrect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 15:45:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897301#M1012733</guid>
      <dc:creator />
      <dc:date>2015-04-24T15:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate scores bases on recent answer</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897302#M1012734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this new expression: &lt;STRONG&gt;=Avg(Aggr(FirstSortedValue(Score, Timestamp), Question, Subject)) &lt;/STRONG&gt;if you want to sum the first response or &lt;STRONG&gt;=Avg(Aggr(FirstSortedValue(Score, -Timestamp), Question, Subject)) &lt;/STRONG&gt;if you want to sum the most recent response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 16:07:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897302#M1012734</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-04-24T16:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate scores bases on recent answer</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897303#M1012736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Apr 2015 18:43:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897303#M1012736</guid>
      <dc:creator />
      <dc:date>2015-04-25T18:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate scores bases on recent answer</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897304#M1012737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; =Avg(Aggr(FirstSortedValue(Score, Timestamp), Question, Subject))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2015 15:00:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-scores-bases-on-recent-answer/m-p/897304#M1012737</guid>
      <dc:creator>pratap6699</dc:creator>
      <dc:date>2015-04-26T15:00:37Z</dc:date>
    </item>
  </channel>
</rss>

