<?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: Sales from previous year in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sales-from-previous-year/m-p/2110507#M1224478</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;Yes, this calculation is quite complex - perhaps more complex than it should be. It looks like it could be simplified quite a bit by using data modeling in the back end and restructuring your data a little bit. However, this is out of scope of this conversation.&lt;/P&gt;
&lt;P&gt;Regarding the previous year - there are a few ways of doing that:&lt;/P&gt;
&lt;P&gt;1. If you are looking for a way to calculate sales for the previous year, compared to the current year (always determined by the current date), then the best way would be to calculated a flag in your Calendar Table that would contain 1 for all the dates in the previous year and 0 or NULL for all other dates. Then you can either add the flag condition to your Set Analysis, or multiply your Sales field by the flag.&lt;/P&gt;
&lt;P&gt;2. If you are looking to show the previous year sales for each period of time (Month, for example), then you'd need to build a so called "As of Date" table. There are several blog articles that describe this technique, including my own, which you can see &lt;A href="https://www.naturalsynergies.com/q-tip-4-how-to-use-as-of-date-table/" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To learn more advanced development techniques, check out the agenda of the &lt;A href="https://masterssummit.com" target="_blank"&gt;Masters Summit for Qlik&lt;/A&gt; - coming soon to Orlando and to Dublin!&lt;/P&gt;</description>
    <pubDate>Mon, 28 Aug 2023 16:13:32 GMT</pubDate>
    <dc:creator>Oleg_Troyansky</dc:creator>
    <dc:date>2023-08-28T16:13:32Z</dc:date>
    <item>
      <title>Sales from previous year</title>
      <link>https://community.qlik.com/t5/QlikView/Sales-from-previous-year/m-p/2109964#M1224472</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am new to QlikView.&lt;/P&gt;
&lt;P&gt;I have a difficult formula here with many filters for calculating our sales. I would like to know how exactly I can display this formula for the respective previous year.&lt;/P&gt;
&lt;P&gt;Thanks a lot in advance&lt;/P&gt;
&lt;P&gt;Formula:&lt;/P&gt;
&lt;DIV&gt;Sum({$&amp;lt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; $(yServiceDBFilter1),&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; $(xvarKundeARKU),&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; V_BelegPos.offen = {'0'},&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; V_BelegPos.BelegArt = {'R','G'},&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; S_KoTraeger.KostenTraeger = {"404","405","406","407","408","4011","4012","4021","4022","4023","4024"}&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; +&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &amp;lt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; S_AuftragsArt.AuftragsArt={"ST","SE","SW"},&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; S_Artikel.ArtikelArt ={61},&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; $(xvarKundeARKU),&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; V_BelegPos.offen = {'0'},&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; V_BelegPos.BelegArt = {'R','G'},&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; S_KoTraeger.KostenTraeger = {"404","405","406","407","408","4011","4012","4021","4022","4023","4024"}&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;Rangesum ( V_BelegPos.xc_Gesamtpreis$(vCurrency) * V_BelegPos.GS_Faktor * V_BelegPos.ZS_Faktor&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;,subfield(V_BelegPos.c_Zuschlag,';',1)&lt;/DIV&gt;
&lt;DIV&gt;,(subfield(V_BelegPos.c_Zuschlag,';',2))&lt;/DIV&gt;
&lt;DIV&gt;,(subfield(V_BelegPos.c_Zuschlag,';',3))&lt;/DIV&gt;
&lt;DIV&gt;,(subfield(V_BelegPos.c_Zuschlag,';',4))&lt;/DIV&gt;
&lt;DIV&gt;,(subfield(V_BelegPos.c_Zuschlag,';',5))&lt;/DIV&gt;
&lt;DIV&gt;)&lt;/DIV&gt;
&lt;DIV&gt;)&lt;/DIV&gt;</description>
      <pubDate>Fri, 25 Aug 2023 15:21:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sales-from-previous-year/m-p/2109964#M1224472</guid>
      <dc:creator>Bad_QlikDeveloper99</dc:creator>
      <dc:date>2023-08-25T15:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Sales from previous year</title>
      <link>https://community.qlik.com/t5/QlikView/Sales-from-previous-year/m-p/2110507#M1224478</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;Yes, this calculation is quite complex - perhaps more complex than it should be. It looks like it could be simplified quite a bit by using data modeling in the back end and restructuring your data a little bit. However, this is out of scope of this conversation.&lt;/P&gt;
&lt;P&gt;Regarding the previous year - there are a few ways of doing that:&lt;/P&gt;
&lt;P&gt;1. If you are looking for a way to calculate sales for the previous year, compared to the current year (always determined by the current date), then the best way would be to calculated a flag in your Calendar Table that would contain 1 for all the dates in the previous year and 0 or NULL for all other dates. Then you can either add the flag condition to your Set Analysis, or multiply your Sales field by the flag.&lt;/P&gt;
&lt;P&gt;2. If you are looking to show the previous year sales for each period of time (Month, for example), then you'd need to build a so called "As of Date" table. There are several blog articles that describe this technique, including my own, which you can see &lt;A href="https://www.naturalsynergies.com/q-tip-4-how-to-use-as-of-date-table/" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To learn more advanced development techniques, check out the agenda of the &lt;A href="https://masterssummit.com" target="_blank"&gt;Masters Summit for Qlik&lt;/A&gt; - coming soon to Orlando and to Dublin!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 16:13:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sales-from-previous-year/m-p/2110507#M1224478</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2023-08-28T16:13:32Z</dc:date>
    </item>
  </channel>
</rss>

