<?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: Scripting help - Max expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973244#M647120</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LastValue(Money) group by Day&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Oct 2015 08:17:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-10-14T08:17:22Z</dc:date>
    <item>
      <title>Scripting help - Max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973243#M647119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In have the following wrong expression which brings me the MAX value from aggregated money formula in a flexible selected period:&lt;/P&gt;&lt;P&gt;=&lt;STRONG&gt;Max (Aggr (Sum (Money),[Day\Month\Year],moneytype))&amp;nbsp; &lt;/STRONG&gt;I should somehow plant the MAX before the day\month\year field BUT I do not know how to script it properly.&amp;nbsp; &lt;/P&gt;&lt;P&gt;How do I script this expression so that it will bring me the &lt;STRONG&gt;LATEST (money) value &lt;/STRONG&gt;from the flexible selected period.&lt;/P&gt;&lt;P&gt;--&amp;nbsp; Like it does &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;successfully&lt;/STRONG&gt;&lt;/SPAN&gt; in a simple SUM expression which I tested in a test data : Sum({&amp;lt;Date={'$(=Max(Date))'}&amp;gt;} money&lt;/P&gt;&lt;P&gt;By the way I tried to write it as LastSortedValule &lt;STRONG style="font-size: 13.3333px;"&gt; (Aggr (Sum (Money),[Day\Month\Year],moneytype))&amp;nbsp;&amp;nbsp; or Last&lt;STRONG style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;SortedValue&lt;/STRONG&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #f2f2f2; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;( Aggr (Sum (Money),[Day/Month/Year],MoneyType), - &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #f2f2f2; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Day/Month/Year]) but it does not work.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The day\month\year is set properly is a date field.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 08:14:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973243#M647119</guid>
      <dc:creator />
      <dc:date>2015-10-14T08:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help - Max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973244#M647120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LastValue(Money) group by Day&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 08:17:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973244#M647120</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-14T08:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help - Max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973245#M647121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the front end, the expression is evaluated in the context of the chart/table dimensions. Without knowing this information I can only give general guidelines of how to do it in script. You will need to fill in the details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;After loading the fact table, do a resident load, with the Max(date), grouping by the appropriate dimensions.&lt;/LI&gt;&lt;LI&gt;Join this table to the fact table&lt;/LI&gt;&lt;LI&gt;The max date values are the ones where Max(date) = date. Set a flag on these values.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this (assumes the fact table is called Fact - change to suit):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Join (Fact)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD Max([Day/Month/Year]) As MaxDMY,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; dimension1,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // the dimensions matching the front end chart&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; dimension2&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident Fact&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Group By &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; dimension1,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; dimension2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Join (Fact)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD ID,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // one or more fields that uniquely identify the Fact table rows&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; [Day/Month/Year],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; MaxDMY,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; If([Day/Month/Year] = MaxDMY, 1, 0) As FlagMaxDMY&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident Fact;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 08:32:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973245#M647121</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-10-14T08:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help - Max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973246#M647122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;Thank you for your effort but I am looking for (am sure that there is ) a more simple solution.&lt;/P&gt;&lt;P&gt;My chart dimensions are : day\month\year and the moneyType.&lt;/P&gt;&lt;P&gt;The user can select from list the relevant period of time (April 2014, last week or the year 2013 and set) &lt;/P&gt;&lt;P&gt;Is I wrote I have managed to solve this issue for a simple sum expression: &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt;Sum({&amp;lt;Date={'$(=Max(Date))'}&amp;gt;} money but this expression was not group by moneytype and was not using aggr (which I must since I collect data from different sources (country, city and so on)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt;I only need to script , if possible, the MAX expression before the date so that the expression will pick the lastest value like it did in the simple sum expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 08:42:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973246#M647122</guid>
      <dc:creator />
      <dc:date>2015-10-14T08:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help - Max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973247#M647123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please give us a sample of your QVW, so that we can take a look and develop a solution?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 08:53:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973247#M647123</guid>
      <dc:creator>miguelbraga</dc:creator>
      <dc:date>2015-10-14T08:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help - Max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973248#M647124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;unfortunately I can not &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 08:56:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973248#M647124</guid>
      <dc:creator />
      <dc:date>2015-10-14T08:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help - Max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973249#M647125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;Data:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load&amp;nbsp; date(&lt;STRONG&gt;Date&lt;/STRONG&gt;,'DD/MM/YYYY') as &lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Key&lt;/STRONG&gt;,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Money,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;moneytype,&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Dimension2&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;From Table;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left join(&lt;EM style="font-size: 13.3333330154419px;"&gt;Data)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;load date(max(&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;Date),&lt;EM style="font-size: 13.3333330154419px;"&gt;'DD/MM/YYYY') as &lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;Date,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;Key&lt;/STRONG&gt;&lt;/EM&gt;,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;moneytype,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;SPAN style="font-size: 13.3333330154419px; line-height: 1.5em;"&gt;1 as MaxDateFlag&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;EM&gt;Resident&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; Data&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;EM&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;group by &lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;Key,&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;moneytype&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;EM&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;EM&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;EM&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Now you can write the expression&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;EM&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;EM&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=sum({&amp;lt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;MaxDateFlag={'1'}&lt;/SPAN&gt;&amp;gt;}Money)&lt;BR /&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 09:08:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-help-Max-expression/m-p/973249#M647125</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2015-10-14T09:08:31Z</dc:date>
    </item>
  </channel>
</rss>

