<?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: Getting Last year and current year data in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Getting-Last-year-and-current-year-data/m-p/1735104#M452563</link>
    <description>&lt;P&gt;Thank you so much !&lt;/P&gt;</description>
    <pubDate>Wed, 12 Aug 2020 06:43:52 GMT</pubDate>
    <dc:creator>Fion_c</dc:creator>
    <dc:date>2020-08-12T06:43:52Z</dc:date>
    <item>
      <title>Getting Last year and current year data</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-Last-year-and-current-year-data/m-p/1730922#M452277</link>
      <description>&lt;P&gt;How can I sum the sales amount for 2019 and 2020 respectively.&lt;BR /&gt;I have data as follows:&lt;/P&gt;&lt;P&gt;client&amp;nbsp; &amp;nbsp; sales&amp;nbsp; &amp;nbsp; &amp;nbsp;date of transaction&lt;BR /&gt;a&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 11/2/2019&lt;BR /&gt;b&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2/3/2019&lt;BR /&gt;c&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 120&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7/7/2019&lt;BR /&gt;d&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 300&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 16/1/2020&lt;BR /&gt;e&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 800&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 31/8/2020&lt;BR /&gt;f&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1000&amp;nbsp; &amp;nbsp; &amp;nbsp; 12/12/2020&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 04:40:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-Last-year-and-current-year-data/m-p/1730922#M452277</guid>
      <dc:creator>Fion_c</dc:creator>
      <dc:date>2020-07-27T04:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Last year and current year data</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-Last-year-and-current-year-data/m-p/1730925#M452278</link>
      <description>&lt;P&gt;Ideally you should have a Year field as well created in the script, like:&lt;/P&gt;&lt;P&gt;Year([date of transaction]) as Year&lt;/P&gt;&lt;P&gt;Then you could simple use expression like:&lt;FONT face="courier new,courier"&gt; Sum({&amp;lt;Year={2019}&amp;gt;}sales)&lt;/FONT&gt; and&amp;nbsp;Sum({&amp;lt;Year={2020}&amp;gt;}sales)&lt;/P&gt;&lt;P&gt;In case, you don't have year field you can try like:&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;[date of transaction]={"=Year([date of transaction])=2019"}&amp;gt;}sales), and&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;[date of transaction]={"=Year([date of transaction])=2020"}&amp;gt;}sales)&lt;/P&gt;&lt;P&gt;Or, to make it more dynamic (w.r.t. current year and previous year)&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Sum({&amp;lt;[date of transaction]={"=Year([date of transaction])=Year(Today())-1"}&amp;gt;}sales)&lt;/FONT&gt;, and&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Sum({&amp;lt;[date of transaction]={"=Year([date of transaction])=Year(Today())"}&amp;gt;}sales)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 05:18:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-Last-year-and-current-year-data/m-p/1730925#M452278</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2020-07-27T05:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Last year and current year data</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-Last-year-and-current-year-data/m-p/1730926#M452279</link>
      <description>&lt;P&gt;most of the time you create a time table in your data model.&lt;/P&gt;&lt;P&gt;check this also&amp;nbsp;&lt;A href="https://community.qlik.com/t5/QlikView-Scripting/Creating-A-Master-Calendar/td-p/341286" target="_blank"&gt;https://community.qlik.com/t5/QlikView-Scripting/Creating-A-Master-Calendar/td-p/341286&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Then you have a column year which you can use as dimension and set an expression on sum(Sales).&lt;/P&gt;&lt;P&gt;here are samples for standalone expressions if you need it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum({$&amp;lt;year={2019}&amp;gt;}sales)
Sum({$&amp;lt;year={'$(=$(vLastYear))'}&amp;gt;}sales)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 05:18:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-Last-year-and-current-year-data/m-p/1730926#M452279</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2020-07-27T05:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Last year and current year data</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-Last-year-and-current-year-data/m-p/1734925#M452550</link>
      <description>&lt;P&gt;Just adding a Design Blog post as well that may be of some use to others that see this thread:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Year-over-Year-Comparisons/ba-p/1462927" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/Year-over-Year-Comparisons/ba-p/1462927&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 17:07:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-Last-year-and-current-year-data/m-p/1734925#M452550</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2020-08-11T17:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Last year and current year data</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-Last-year-and-current-year-data/m-p/1735104#M452563</link>
      <description>&lt;P&gt;Thank you so much !&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 06:43:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-Last-year-and-current-year-data/m-p/1735104#M452563</guid>
      <dc:creator>Fion_c</dc:creator>
      <dc:date>2020-08-12T06:43:52Z</dc:date>
    </item>
  </channel>
</rss>

