<?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: Aggr: Latest status based on day selection in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525843#M480644</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;tresesco a écrit:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Why C should not be counted for status 'Open' and max Action_ID=32?&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Because Action_ID = 32 is not the latest action made on Order C. Latest action is &lt;SPAN style="font-family: 'Lucida Grande', Arial, Helvetica, sans-serif;"&gt;Action_ID=33 made on day 4 (part of the selection) so I should only look at this particular one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try to reformulate my requirement in a more functional way:&lt;/P&gt;&lt;P&gt;"I want to count how many orders are Open and how many are Closed as of latest day of my selection on Day"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I select days 1 to 4 ("I want to count Orders per Status as of day 4"):&lt;/P&gt;&lt;P&gt;Order A is Open as of day 4 (nothing happened since day 2)&lt;/P&gt;&lt;P&gt;Order B is Open as of day 4 (nothing happened since day 3)&lt;/P&gt;&lt;P&gt;Order C is Closed as of day 4 (it was closed on day 4)&lt;/P&gt;&lt;P&gt;Order D is Closed as of day 4 (nothing happened since day 3)&lt;/P&gt;&lt;P&gt;Order E is Closed as of day 4 (it was closed on day 4)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I select days 1 to 5 ("I want to count Orders per Status as of day 5"):&lt;/P&gt;&lt;P&gt;Nothing will change for Orders A, B, C and D (no action/status change on day 5).&lt;/P&gt;&lt;P&gt;Order E will be counted as Open instead of Closed because an action performed on day 5 (&lt;SPAN style="font-family: 'Lucida Grande', Arial, Helvetica, sans-serif;"&gt;Action_ID=52) &lt;/SPAN&gt;switched its status from Closed to Open&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it clarifies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Nov 2013 13:03:03 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-11-14T13:03:03Z</dc:date>
    <item>
      <title>Aggr: Latest status based on day selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525841#M480642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following data:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="399" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="width: 204px; height: 399px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="68"&gt;&lt;STRONG style="font-size: 8pt;"&gt;Order_ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="62"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;Action_ID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="38"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;Day&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="40"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;Status&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;A&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;10&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Open&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;A&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;11&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Open&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;B&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;20&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Open&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;B&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;21&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Open&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;B&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;22&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Open&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;C&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;30&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Open&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;C&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;31&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Closed&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;C&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;32&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Open&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;C&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;33&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;4&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Closed&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;D&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;40&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Open&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;D&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;41&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Open&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;D&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;42&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Closed&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;E&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;50&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Open&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;E&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;51&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Closed&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;E&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;52&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Open&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On each Order, a user can make an action which may change the Status of the Order.&lt;/P&gt;&lt;P&gt;Example: On Day 5 the user made an action (Action_ID = 52) on Order 'E' which changed its status from 'Closed' to 'Open'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create a bar graph with Status as a Dimension which counts the Orders based on the &lt;SPAN style="text-decoration: underline;"&gt;latest action&lt;/SPAN&gt; made and depending on the Day selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If I select Days 1,2,3,4, the Graph should behave as follow:&lt;/P&gt;&lt;P&gt;Open = 2&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;+1 for Order_ID = A and Action_ID = 11 (latest action made on order A within Day selection)&lt;/LI&gt;&lt;LI&gt;+1 for Order_ID = B and Action_ID = 22 (latest action made on order B within Day selection)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Closed = 3&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;+1 for Order_ID = C and Action_ID = 33 (latest action made on order C within Day selection)&lt;/LI&gt;&lt;LI&gt;+1 for Order_ID = D and Action_ID = 42 (latest action made on order D within Day selection. Action 31 is not counted because not the latest action made)&lt;/LI&gt;&lt;LI&gt;+1 for Order_ID = E and Action_ID = 51 (latest action made on order E within Day selection. Action 52 is not counted in the "Open" because it was made on day 5 which is out of the selection)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Qlikview.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/48964_Qlikview.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I built the below expression:&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_1384429208826747" jivemacro_uid="_1384429208826747"&gt;
&lt;P&gt;=count(aggr(Max(Action_ID), Order_ID))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume it works that way:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Aggr builds a temp table which get the latest Action made on each order &lt;SPAN style="text-decoration: underline;"&gt;within the selection made on Day&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Count the Action_ID (hence the orders) depending on the status thanks to the graph dimension&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It doesn't work so I guess my assumptions above are incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Somebody would have an idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 12:00:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525841#M480642</guid>
      <dc:creator />
      <dc:date>2013-11-14T12:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr: Latest status based on day selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525842#M480643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not really sure about the requirement. Why C should not be counted for status 'Open' and max Action_ID=32? It seems that you are counting all Order_IDs once within scope. Then can try like:&lt;/P&gt;&lt;P&gt;=Count(DISTINCT Order_ID)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Else, you might have to explain in a simpler way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 12:34:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525842#M480643</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2013-11-14T12:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr: Latest status based on day selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525843#M480644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;tresesco a écrit:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Why C should not be counted for status 'Open' and max Action_ID=32?&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Because Action_ID = 32 is not the latest action made on Order C. Latest action is &lt;SPAN style="font-family: 'Lucida Grande', Arial, Helvetica, sans-serif;"&gt;Action_ID=33 made on day 4 (part of the selection) so I should only look at this particular one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try to reformulate my requirement in a more functional way:&lt;/P&gt;&lt;P&gt;"I want to count how many orders are Open and how many are Closed as of latest day of my selection on Day"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I select days 1 to 4 ("I want to count Orders per Status as of day 4"):&lt;/P&gt;&lt;P&gt;Order A is Open as of day 4 (nothing happened since day 2)&lt;/P&gt;&lt;P&gt;Order B is Open as of day 4 (nothing happened since day 3)&lt;/P&gt;&lt;P&gt;Order C is Closed as of day 4 (it was closed on day 4)&lt;/P&gt;&lt;P&gt;Order D is Closed as of day 4 (nothing happened since day 3)&lt;/P&gt;&lt;P&gt;Order E is Closed as of day 4 (it was closed on day 4)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I select days 1 to 5 ("I want to count Orders per Status as of day 5"):&lt;/P&gt;&lt;P&gt;Nothing will change for Orders A, B, C and D (no action/status change on day 5).&lt;/P&gt;&lt;P&gt;Order E will be counted as Open instead of Closed because an action performed on day 5 (&lt;SPAN style="font-family: 'Lucida Grande', Arial, Helvetica, sans-serif;"&gt;Action_ID=52) &lt;/SPAN&gt;switched its status from Closed to Open&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it clarifies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 13:03:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525843#M480644</guid>
      <dc:creator />
      <dc:date>2013-11-14T13:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr: Latest status based on day selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525844#M480645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I build a small table to verify my assumption 1: "Aggr builds a temp table which get the latest Action made on each order &lt;SPAN style="font-style: inherit; font-family: inherit; text-decoration: underline;"&gt;within the selection made on Day&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems to work and properly adjust to selections on Day (If I select from Day 1 up to Day 5 I get Action_ID 55 for E):&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Qlikview.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/48994_Qlikview.png" /&gt;&lt;IMG alt="Qlikview2.PNG.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/48995_Qlikview2.PNG.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Qlikview3.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/48996_Qlikview3.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I need to be able to count the orders and dispatch per Status but the expression [ &lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;=count(aggr(Max(Action_ID), Order_ID))&lt;/SPAN&gt; ] does not work: It does not take into account the graph dimension (Status) to dispatch:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Qlikview4.PNG.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/48997_Qlikview4.PNG.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 17:21:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525844#M480645</guid>
      <dc:creator />
      <dc:date>2013-11-14T17:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr: Latest status based on day selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525845#M480646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;"I want to count how many orders are Open and how many are Closed as of latest day of my selection on Day"&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;maybe this can run:&lt;/P&gt;&lt;P&gt;sum(if(aggr(firstsortedvalue(Status,-Day),ActionID)='Open',1,0)&amp;nbsp; // Open&lt;/P&gt;&lt;P&gt;sum(if(aggr(firstsortedvalue(Status,-Day),ActionID)='Closed',1,0)&amp;nbsp; // Closed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 17:54:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525845#M480646</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2013-11-14T17:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Aggr: Latest status based on day selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525846#M480647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It indeed works:&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="_jivemacro_uid_13844529746382814 jive_text_macro jive_macro_code" jivemacro_uid="_13844529746382814" modifiedtitle="true"&gt;
&lt;P&gt;sum(if(aggr(firstsortedvalue(Status,-Day),Order_ID)='Open',1,0))&lt;/P&gt;
&lt;P&gt;sum(if(aggr(firstsortedvalue(Status,-Day),Order_ID)='Closed',1,0))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I understand correctly instead of retrieving latest action and deduce the latest status from it, you directly get the latest status using FirstSortedValue within aggr using Day as the weight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea why it doesn't work if I put Status as the graph dimension and keep one expression only (remove the if testing Status value) ?&lt;/P&gt;&lt;P&gt;Aggr is supposed to be dimension sensitive&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13844531255099848" jivemacro_uid="_13844531255099848" modifiedtitle="true"&gt;
&lt;P&gt;sum(aggr(firstsortedvalue(Status,-Day),Order_ID))&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 18:23:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525846#M480647</guid>
      <dc:creator />
      <dc:date>2013-11-14T18:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr: Latest status based on day selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525847#M480648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;If I understand correctly instead of retrieving latest action and deduce the latest status from it, you directly get the latest status using FirstSortedValue within aggr using Day as the weight&lt;/SPAN&gt;" Correct!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don´t know why does not work the other way. Could you post a sample? I´ll do some tests&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 18:26:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525847#M480648</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2013-11-14T18:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Aggr: Latest status based on day selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525848#M480649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here you go!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to implement your solution in the my real app (datamodel much more complicated) and I get wrong results &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P&gt;Need to investigate further...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 19:02:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525848#M480649</guid>
      <dc:creator />
      <dc:date>2013-11-14T19:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr: Latest status based on day selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525849#M480650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Checking here:&lt;/P&gt;&lt;P&gt;count(aggr(firstsortedvalue(Status,-Day),Order_ID,Status)) returns values, but they´re not correct, because we need to count an Order_ID only once. Using a dimension, they´re counted twice (one last value to each Status)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don´t see right now a way of doing what you want, using Status as a dimension, sorry&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 19:09:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Latest-status-based-on-day-selection/m-p/525849#M480650</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2013-11-14T19:09:43Z</dc:date>
    </item>
  </channel>
</rss>

