<?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: Expression for 'Closing' Figures in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756347#M269289</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This expression only gives the closing stock for the very last date in the dataset. When used in a straight table broken down by week for example, it only shows the last week.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Dec 2014 10:47:13 GMT</pubDate>
    <dc:creator>johnso2080</dc:creator>
    <dc:date>2014-12-02T10:47:13Z</dc:date>
    <item>
      <title>Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756345#M269287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm trying to create an expression that gives me the sum of stock from only the LAST date of the current selection...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A basic equivalent of the tables used are...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;StockHistory:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Product ID&lt;/P&gt;&lt;P&gt;Date&lt;/P&gt;&lt;P&gt;Stock Level&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Products:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Product ID&lt;/P&gt;&lt;P&gt;Category 1&lt;/P&gt;&lt;P&gt;Category 2&lt;/P&gt;&lt;P&gt;Category 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Calendar:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Date&lt;/P&gt;&lt;P&gt;Week&lt;/P&gt;&lt;P&gt;Month&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need, for any selections that may occur, the SUM([Stock Level]) only for the last date in the selection or the dimension in a chart. For example we might want to see a table with dimensions [Week] and [Category 3] and we would want to see the sum of stock for each category on the last day of each week shown in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, the dimensions are not set in the tables/charts themselves, they are dynamic based on user selections/variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that's clear! Any help much appreciated! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Darren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 10:00:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756345#M269287</guid>
      <dc:creator>johnso2080</dc:creator>
      <dc:date>2014-12-02T10:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756346#M269288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Darren,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try to use Set Analysis in your Expression (sum {&amp;lt;Date = {'$(=max(Date))'}&amp;gt;} StockLevel)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 10:40:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756346#M269288</guid>
      <dc:creator>mato32188</dc:creator>
      <dc:date>2014-12-02T10:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756347#M269289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This expression only gives the closing stock for the very last date in the dataset. When used in a straight table broken down by week for example, it only shows the last week.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 10:47:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756347#M269289</guid>
      <dc:creator>johnso2080</dc:creator>
      <dc:date>2014-12-02T10:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756348#M269290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok,&amp;nbsp; what about firstsortedvalue(stocklevel, - date)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 11:09:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756348#M269290</guid>
      <dc:creator>mato32188</dc:creator>
      <dc:date>2014-12-02T11:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756349#M269291</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;This brings back just one stock figure for one item (the last one). I need the sum of all items on the last day of the selection or dimension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Darren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 11:54:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756349#M269291</guid>
      <dc:creator>johnso2080</dc:creator>
      <dc:date>2014-12-02T11:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756350#M269292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Darren,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would look into creating some fields with the relevant point in time flags you require for your dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sounds like you need an [Is Week End] and [Is Month End] flag. Once you have those flags you can use them within you set analysis expression to only give you the sum of the required days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum( {&amp;lt;[Is Week End]= {1}&amp;gt;} StockLevel)&lt;/P&gt;&lt;P&gt;would the only bring back data for the required days meaning you would get the correct figure in each of your week dimension values. Same applies for month&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope that helps&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 12:15:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756350#M269292</guid>
      <dc:creator />
      <dc:date>2014-12-02T12:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756351#M269293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 12:21:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756351#M269293</guid>
      <dc:creator>mato32188</dc:creator>
      <dc:date>2014-12-02T12:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756352#M269294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Joe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this would be a bit awkward to implement, the user will use a dimension 'group' to choose how they trend the data (by date, week, month etc) so I won't know what the user is looking at to use the relevant parameter. I was ideally looking for one expression that works holistically. So far I've got to this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue(AGGR(SUM({$} [StockLevel]),[Date]),0-AGGR(MAX({$} [Date]),[Date]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which seems to work when breaking down the total stock by period, however, when add another dimension such as product category, the data is completely wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Darren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 12:27:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756352#M269294</guid>
      <dc:creator>johnso2080</dc:creator>
      <dc:date>2014-12-02T12:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756353#M269295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Totally get where you are coming from, rather than a single complex expression, I would maybe look to use multiple simple expressions which are conditionally calculated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use GetCurrentField(groupname) to give you which dimension is currently active in the group and based on that conditionally show the required expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;condition: GetCurrentField(groupname)='Week'&lt;/P&gt;&lt;P&gt;expression: Sum( {&amp;lt;[Is Week End]= {1}&amp;gt;} StockLevel)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;condition: GetCurrentField(groupname)='Month'&lt;/P&gt;&lt;P&gt;expression: Sum( {&amp;lt;[Is Month End]= {1}&amp;gt;} StockLevel)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you will find performance better also&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope that helps&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 12:45:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756353#M269295</guid>
      <dc:creator />
      <dc:date>2014-12-02T12:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756354#M269296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm afraid I haven't been able to apply this expression to my data model.&lt;/P&gt;&lt;P&gt;I've also found when I extend the data in your example (attached) I don't get results? Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Darren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 12:57:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756354#M269296</guid>
      <dc:creator>johnso2080</dc:creator>
      <dc:date>2014-12-02T12:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756355#M269297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Joe, it seems like I might have to go with this approach...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 13:31:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756355#M269297</guid>
      <dc:creator>johnso2080</dc:creator>
      <dc:date>2014-12-02T13:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756356#M269298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no worries, glad to help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 13:34:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756356#M269298</guid>
      <dc:creator />
      <dc:date>2014-12-02T13:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Expression for 'Closing' Figures</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756357#M269299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, are there any other ideas on this one..? &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 16:31:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-for-Closing-Figures/m-p/756357#M269299</guid>
      <dc:creator>johnso2080</dc:creator>
      <dc:date>2014-12-04T16:31:55Z</dc:date>
    </item>
  </channel>
</rss>

