<?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: Last value of a dimension as a condition in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1786280#M61323</link>
    <description>&lt;P&gt;Nevermind, I got it!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;VERSION = {'HISTORICAL'} , Date = {"*2021*"}&amp;gt;} [Parts and Accessories])&lt;BR /&gt;+Sum({&amp;lt;VERSION={"$(=MaxString(VERSION))"}, Date = {"*2021*"}&amp;gt;} [Parts and Accessories])&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2021 15:48:29 GMT</pubDate>
    <dc:creator>gitguto</dc:creator>
    <dc:date>2021-02-25T15:48:29Z</dc:date>
    <item>
      <title>Last value of a dimension as a condition</title>
      <link>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1785935#M61279</link>
      <description>&lt;P&gt;Hey folks,&lt;/P&gt;&lt;P&gt;I have three columns "Version", "Units sold" and "Date". I need to find an expression that is able to:&lt;/P&gt;&lt;P&gt;sum(units sold in 2021 from the historical version + units sold in 2021 from the latest version available).&lt;/P&gt;&lt;P&gt;I can't find a solution because the version name changes every week from w1 to w2, w3... and they don't have fixed starting dates associated with them. (Ex. w01 doesn't necessarily starts from 1/1/2021, w2 doesn't necessarily starts from 1/8/2021, etc)&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;VERSION&lt;/TD&gt;&lt;TD&gt;UNITS SOLD&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;HISTORICAL&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;12/1/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;HISTORICAL&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;1/1/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;w01&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;1/1/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;w01&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;1/1/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;w02&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;1/1/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;w02&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;1/8/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;w05&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;1/15/2021&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected output = 20 + 30 = 50&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried MaxString, but it returns "HISTORICAL" instead of the latest W#&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;VERSION = {'$(=Maxstring([VERSION]))'} , Date = {"&amp;gt;=$(=YearStart(max(Date)))"}&amp;gt;} [Units Sold]) +&lt;BR /&gt;Sum({&amp;lt;VERSION = {'HISTORICAL'} ,&amp;nbsp; Date = {"&amp;gt;=$(=YearStart(max(Date)))"}&amp;gt;} [Units Sold])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S. I'm writing this expression in the "Edit Expression" field inside a bar chart&amp;nbsp; -&amp;gt;Data - Measure(Length of bars)&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 00:32:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1785935#M61279</guid>
      <dc:creator>gitguto</dc:creator>
      <dc:date>2024-11-16T00:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Last value of a dimension as a condition</title>
      <link>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1785998#M61285</link>
      <description>&lt;P&gt;Try this,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=Sum({&amp;lt;VERSION = {'HISTORICAL'}, Date = {"&amp;gt;=$(=YearStart(max(Date)))"}&amp;gt;} [UNITS SOLD])
=Sum({&amp;lt;VERSION = {"w*"}, Date={"&amp;gt;=$(=max(Date))"}&amp;gt;} [UNITS SOLD])&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commQV18.PNG" style="width: 586px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/49819i0A0F31D936EBA8AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="commQV18.PNG" alt="commQV18.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 04:03:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1785998#M61285</guid>
      <dc:creator>Saravanan_Desingh</dc:creator>
      <dc:date>2021-02-25T04:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Last value of a dimension as a condition</title>
      <link>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1786213#M61310</link>
      <description>&lt;P&gt;Thanks for the reply,&lt;/P&gt;&lt;P&gt;Unfortunately this does not work because I need to sum all the values from the latest version from 2021, not only the entry with the maximum Date.&lt;/P&gt;&lt;P&gt;I'll give you another example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gitguto_0-1614264273477.png" style="width: 592px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/49882i7E436A0CB495E243/image-dimensions/592x224?v=v2" width="592" height="224" role="button" title="gitguto_0-1614264273477.png" alt="gitguto_0-1614264273477.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In this case, my expected output would be 20 + 10 + 25 + 30 = 85. That is (20 +10 = (all units sold in 2021 from the historical version) + 25 +30 = (all units sold in 2021 from the latest version available, in this example it would be w04)&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 14:45:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1786213#M61310</guid>
      <dc:creator>gitguto</dc:creator>
      <dc:date>2021-02-25T14:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Last value of a dimension as a condition</title>
      <link>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1786239#M61316</link>
      <description>&lt;P&gt;Please try this-&lt;/P&gt;&lt;P&gt;Instead of single quote, try with double quotes as mine is working , refer below-&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;VERSION={"$(=MaxString(VERSION))"},Date={"&amp;gt;=$(=Yearstart(max(Date)))"}&amp;gt;}[UNITS SOLD])+&lt;BR /&gt;sum({&amp;lt;VERSION={'HISTORICAL'},Date={"&amp;gt;=$(=Yearstart(max(Date)))"}&amp;gt;}[UNITS SOLD])&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 15:18:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1786239#M61316</guid>
      <dc:creator>salonicdk28</dc:creator>
      <dc:date>2021-02-25T15:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Last value of a dimension as a condition</title>
      <link>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1786262#M61320</link>
      <description>&lt;P&gt;Thank you!! It works!!&lt;/P&gt;&lt;P&gt;In the same thread, would you know how to fix the Year to 2021? I'm afraid this Yearstart(max(Date)) condition will fail eventually when I start getting data from 2022. I tried something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Date={"$(=Year(Date) = 2021))"} but it returns 0&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 15:36:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1786262#M61320</guid>
      <dc:creator>gitguto</dc:creator>
      <dc:date>2021-02-25T15:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Last value of a dimension as a condition</title>
      <link>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1786280#M61323</link>
      <description>&lt;P&gt;Nevermind, I got it!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;VERSION = {'HISTORICAL'} , Date = {"*2021*"}&amp;gt;} [Parts and Accessories])&lt;BR /&gt;+Sum({&amp;lt;VERSION={"$(=MaxString(VERSION))"}, Date = {"*2021*"}&amp;gt;} [Parts and Accessories])&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 15:48:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Last-value-of-a-dimension-as-a-condition/m-p/1786280#M61323</guid>
      <dc:creator>gitguto</dc:creator>
      <dc:date>2021-02-25T15:48:29Z</dc:date>
    </item>
  </channel>
</rss>

