<?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 Challenging problem : Error between years in variables. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Challenging-problem-Error-between-years-in-variables/m-p/211438#M65702</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys, I got stuck the whole day doing this stuff.&lt;/P&gt;&lt;P&gt;I have two variables in my document : maxYear and preMaxYear.&lt;/P&gt;&lt;P&gt;1-MaxYear : If Year is not clicked, it will get the maximum year possible, otherwise, it will get the selected year.&lt;/P&gt;&lt;P style="font-weight: bold"&gt;MaxYear = IF(getpossiblecount([Año]) = 1 ,Año,max(Año))&lt;/P&gt;&lt;P&gt;2-preMaxYear : If Year is not clicked, it will get the second maximum year possible, otherwise, it will get the selected year -1.&lt;/P&gt;&lt;P style="font-weight: bold"&gt;preMaxYear =IF(getpossiblecount([Año]) = 1 ,Año - 1,max(Año,2) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm doing a comparison between profit and loss between maxYear and preMaxYear.&lt;/P&gt;&lt;P&gt;If there is no year clicked, and &lt;I&gt;maxYear = 2010 (by default) and preMaxYear = 2009 (by default as well)&lt;/I&gt;. Everything is fine :&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error loading image" class="jive-image error-loading-image" src="https://community.qlik.com/legacyfs/online/-2997_sourceID:2997" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, if I select &lt;I&gt;Year = 2010,&lt;/I&gt; the same should happen, because maxYear and preMaxYear take the same values, but it doesn't work fine for the preMaxYear Table, as you can see :&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error loading image" class="jive-image error-loading-image" src="https://community.qlik.com/legacyfs/online/-2998_sourceID:2998" /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to fix that, I've thought about duplicating the field year (I thought it was some associating problem), but it doesn't work.&lt;/P&gt;&lt;P&gt;I have a master calendar. I've changed into a calendar inside the facts table. But it doesn't work as well.&lt;/P&gt;&lt;P&gt;I have no idea how to solve this problem.&lt;/P&gt;&lt;P&gt;Any kind of help would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks in advance!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Dec 2010 18:08:12 GMT</pubDate>
    <dc:creator>marcel_olmo</dc:creator>
    <dc:date>2010-12-02T18:08:12Z</dc:date>
    <item>
      <title>Challenging problem : Error between years in variables.</title>
      <link>https://community.qlik.com/t5/QlikView/Challenging-problem-Error-between-years-in-variables/m-p/211438#M65702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys, I got stuck the whole day doing this stuff.&lt;/P&gt;&lt;P&gt;I have two variables in my document : maxYear and preMaxYear.&lt;/P&gt;&lt;P&gt;1-MaxYear : If Year is not clicked, it will get the maximum year possible, otherwise, it will get the selected year.&lt;/P&gt;&lt;P style="font-weight: bold"&gt;MaxYear = IF(getpossiblecount([Año]) = 1 ,Año,max(Año))&lt;/P&gt;&lt;P&gt;2-preMaxYear : If Year is not clicked, it will get the second maximum year possible, otherwise, it will get the selected year -1.&lt;/P&gt;&lt;P style="font-weight: bold"&gt;preMaxYear =IF(getpossiblecount([Año]) = 1 ,Año - 1,max(Año,2) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm doing a comparison between profit and loss between maxYear and preMaxYear.&lt;/P&gt;&lt;P&gt;If there is no year clicked, and &lt;I&gt;maxYear = 2010 (by default) and preMaxYear = 2009 (by default as well)&lt;/I&gt;. Everything is fine :&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error loading image" class="jive-image error-loading-image" src="https://community.qlik.com/legacyfs/online/-2997_sourceID:2997" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, if I select &lt;I&gt;Year = 2010,&lt;/I&gt; the same should happen, because maxYear and preMaxYear take the same values, but it doesn't work fine for the preMaxYear Table, as you can see :&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error loading image" class="jive-image error-loading-image" src="https://community.qlik.com/legacyfs/online/-2998_sourceID:2998" /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to fix that, I've thought about duplicating the field year (I thought it was some associating problem), but it doesn't work.&lt;/P&gt;&lt;P&gt;I have a master calendar. I've changed into a calendar inside the facts table. But it doesn't work as well.&lt;/P&gt;&lt;P&gt;I have no idea how to solve this problem.&lt;/P&gt;&lt;P&gt;Any kind of help would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks in advance!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Dec 2010 18:08:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Challenging-problem-Error-between-years-in-variables/m-p/211438#M65702</guid>
      <dc:creator>marcel_olmo</dc:creator>
      <dc:date>2010-12-02T18:08:12Z</dc:date>
    </item>
    <item>
      <title>Challenging problem : Error between years in variables.</title>
      <link>https://community.qlik.com/t5/QlikView/Challenging-problem-Error-between-years-in-variables/m-p/211439#M65703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try sum( $ {&lt;B&gt;1&lt;/B&gt; &amp;lt;Ano= { $(maxYear) } &amp;gt;} Profit ) instead of sum( $ { &lt;B&gt;&lt;/B&gt;&amp;lt;Ano= { $(maxYear) } &amp;gt;} Profit ) . That's because the year selection might restrict values in other columns.&lt;/P&gt;&lt;P&gt;-Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Dec 2010 07:33:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Challenging-problem-Error-between-years-in-variables/m-p/211439#M65703</guid>
      <dc:creator />
      <dc:date>2010-12-03T07:33:13Z</dc:date>
    </item>
    <item>
      <title>Challenging problem : Error between years in variables.</title>
      <link>https://community.qlik.com/t5/QlikView/Challenging-problem-Error-between-years-in-variables/m-p/211440#M65704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Alexander for your Reply. I'm afraid is more complicated than that. I've tried ( in one of my many attempts to make it work and it doesn't work fine).&lt;/P&gt;&lt;P&gt;But recently I've discovered that only the account which doesn't have "facts" in correlative years (2010,2009,2008 and so on), are the one which fails.&lt;/P&gt;&lt;P&gt;What I mean is, if my current selected year is 2010, and I have an account which belongs only to 2009, it puts 0 in the partial result. But no in the whole result.&lt;/P&gt;&lt;P&gt;I don't understand anything!!! &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is how I currently calculate my profit and loss statements :&lt;/P&gt;&lt;P&gt;Profit (The accounts which begin with number 7, Manager1 is the result row,and the previous last year):&lt;/P&gt;&lt;P style="font-weight: bold"&gt;sum( {1&amp;lt;[Año] = {$(preMaxYear)}, Manager1 = {"=LEFT(Manager1,5) = 'D.TOT' "}, N_Fila_Cuenta = {"=LEFT(N_Fila_Cuenta,1) = '7' "} &amp;gt;} [Asiento Importe])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loss (The accounts which begin with number 6, Manager1 is the result row,and the previous last year):&lt;/P&gt;&lt;P style="font-weight: bold"&gt;sum( {1&amp;lt;[Año] = {$(preMaxYear)}, Manager1 = {"=LEFT(Manager1,5) = 'D.TOT' "}, N_Fila_Cuenta = {"=LEFT(N_Fila_Cuenta,1) = '6' "} &amp;gt;} [Asiento Importe])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And my Profit and Loss calculation is the sumation of the two formulas above (it doesn't work fine for non correlative accounts:&lt;/P&gt;&lt;P&gt;&lt;B&gt;column(1) + column(2).&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And this Profit and Loss formula works fine in every case, and I don't know why :&lt;/P&gt;&lt;P style="font-weight: bold"&gt;sum({$&amp;lt;[Año] = {$(preMaxYear)}, Manager1 = {"=LEFT(Manager1,5) = 'D.TOT' "} &amp;gt;} [Asiento Importe])&lt;/P&gt;&lt;P&gt;I know maybe is some kind of association error, but I cannot look at the original code of Qlikview, so I cannot debug or test it very well.&lt;/P&gt;&lt;P&gt;Any suggestion??&lt;/P&gt;&lt;P&gt;Many thanks in advance!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Dec 2010 13:49:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Challenging-problem-Error-between-years-in-variables/m-p/211440#M65704</guid>
      <dc:creator>marcel_olmo</dc:creator>
      <dc:date>2010-12-03T13:49:12Z</dc:date>
    </item>
  </channel>
</rss>

