<?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 Display Sum Based on the Largest Value in a Field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Display-Sum-Based-on-the-Largest-Value-in-a-Field/m-p/206355#M62509</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm new to QlikView, so hopefully this is a very basic question that I just haven't been able to figure out the syntax for yet. I want to sum up some data based on a specified week. The week data isn't a calendar week but a field specifying the current year and week of the year (i.e. this week is listed as 200940 and last week was 200939).&lt;/P&gt;&lt;P&gt;I would like to tell the code to figure out the most recent (largest) value in the Week field and then sum up all values that correspond to that particular week. Also, I would like to do the same for last week.&lt;/P&gt;&lt;P&gt;Any guidance you could provide a QlikView newbie would be appreciated.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Oct 2009 23:57:42 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-10-02T23:57:42Z</dc:date>
    <item>
      <title>Display Sum Based on the Largest Value in a Field</title>
      <link>https://community.qlik.com/t5/QlikView/Display-Sum-Based-on-the-Largest-Value-in-a-Field/m-p/206355#M62509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm new to QlikView, so hopefully this is a very basic question that I just haven't been able to figure out the syntax for yet. I want to sum up some data based on a specified week. The week data isn't a calendar week but a field specifying the current year and week of the year (i.e. this week is listed as 200940 and last week was 200939).&lt;/P&gt;&lt;P&gt;I would like to tell the code to figure out the most recent (largest) value in the Week field and then sum up all values that correspond to that particular week. Also, I would like to do the same for last week.&lt;/P&gt;&lt;P&gt;Any guidance you could provide a QlikView newbie would be appreciated.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2009 23:57:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-Sum-Based-on-the-Largest-Value-in-a-Field/m-p/206355#M62509</guid>
      <dc:creator />
      <dc:date>2009-10-02T23:57:42Z</dc:date>
    </item>
    <item>
      <title>Display Sum Based on the Largest Value in a Field</title>
      <link>https://community.qlik.com/t5/QlikView/Display-Sum-Based-on-the-Largest-Value-in-a-Field/m-p/206356#M62510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, if it isn't already, I would make the underlying numeric value of the week be a real date field so that you can perform real date manipulations on it. To do that, you'd do something like this in your load:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;dual(year(Date)&amp;amp;week(Date),weekstart(Date)) as Week&lt;/P&gt;&lt;P&gt;Untested, but I think your expression would then look like this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum({&amp;lt;Week={$(=year(max({1} total Week) )&amp;amp;week(max({1} total Week) ))}&amp;gt;} Value)&lt;BR /&gt;sum({&amp;lt;Week={$(=year(max({1} total Week)-7)&amp;amp;week(max({1} total Week)-7))}&amp;gt;} Value)&lt;/P&gt;&lt;P&gt;Or for simpler but slower-to-process expressions, or if you aren't on 8.5 or 9.0 yet:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum(if(Week=max(all Week) ,Value))&lt;BR /&gt;sum(if(Week=max(all Week)-7,Value))&lt;/P&gt;&lt;P&gt;I may be making it more complicated than it is, though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Oct 2009 00:25:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-Sum-Based-on-the-Largest-Value-in-a-Field/m-p/206356#M62510</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-10-03T00:25:12Z</dc:date>
    </item>
    <item>
      <title>Display Sum Based on the Largest Value in a Field</title>
      <link>https://community.qlik.com/t5/QlikView/Display-Sum-Based-on-the-Largest-Value-in-a-Field/m-p/206357#M62511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, John. I'd forgotten about the All qualifier in the Max statement. My calculation works like a charm now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Oct 2009 03:04:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-Sum-Based-on-the-Largest-Value-in-a-Field/m-p/206357#M62511</guid>
      <dc:creator />
      <dc:date>2009-10-03T03:04:18Z</dc:date>
    </item>
    <item>
      <title>Display Sum Based on the Largest Value in a Field</title>
      <link>https://community.qlik.com/t5/QlikView/Display-Sum-Based-on-the-Largest-Value-in-a-Field/m-p/206358#M62512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad you got it working. Note that the ALL qualifier MAY go away in a future version. The documentation appears to be pushing us towards using {1} TOTAL instead. ALL seems more clear, though, and I'm kind of hoping they never take it away because of that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Oct 2009 03:10:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-Sum-Based-on-the-Largest-Value-in-a-Field/m-p/206358#M62512</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-10-03T03:10:11Z</dc:date>
    </item>
  </channel>
</rss>

