<?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 Subtract two fields based on year in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Subtract-two-fields-based-on-year/m-p/873783#M305229</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_StoreID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='34',&lt;BR /&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='2014',&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_CPH_Actual&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))-(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='2015',&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_CPH_Actual&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;By Store, I need to subtract &lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_CPH_Actual&lt;/SPAN&gt; from 2014 and 2015. What is the best way to write this?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 May 2015 21:22:11 GMT</pubDate>
    <dc:creator>jenmclean</dc:creator>
    <dc:date>2015-05-28T21:22:11Z</dc:date>
    <item>
      <title>Subtract two fields based on year</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-two-fields-based-on-year/m-p/873783#M305229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_StoreID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='34',&lt;BR /&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='2014',&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_CPH_Actual&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))-(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='2015',&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_CPH_Actual&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;By Store, I need to subtract &lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PROD_CPH_Actual&lt;/SPAN&gt; from 2014 and 2015. What is the best way to write this?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 21:22:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-two-fields-based-on-year/m-p/873783#M305229</guid>
      <dc:creator>jenmclean</dc:creator>
      <dc:date>2015-05-28T21:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract two fields based on year</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-two-fields-based-on-year/m-p/873784#M305230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use set analysis for this - in this case changed to flexible years depending from the selections but you could replace it with fixed values like the StoreID:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;sum({&amp;lt; &lt;SPAN style="color: #800000;"&gt;PROD_StoreID &lt;/SPAN&gt;= {34}, &lt;SPAN style="color: #800000;"&gt;PROD_Year&lt;/SPAN&gt; = {"$(=max(&lt;SPAN style="color: #800000;"&gt;PROD_Year&lt;/SPAN&gt;) -1)"}&amp;gt;} &lt;SPAN style="color: #800000;"&gt;PROD_CPH_Actual&lt;/SPAN&gt;) -&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;sum({&amp;lt; &lt;SPAN style="color: #800000;"&gt;PROD_StoreID &lt;/SPAN&gt;= {34}, &lt;SPAN style="color: #800000;"&gt;PROD_Year&lt;/SPAN&gt; = {"$(=max(&lt;SPAN style="color: #800000;"&gt;PROD_Year&lt;/SPAN&gt;))"}&amp;gt;} &lt;SPAN style="color: #800000;"&gt;PROD_CPH_Actual&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 06:25:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-two-fields-based-on-year/m-p/873784#M305230</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-05-29T06:25:44Z</dc:date>
    </item>
  </channel>
</rss>

