<?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: YTD calculations not working with variable in Visualization and Usability</title>
    <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613815#M143753</link>
    <description>&lt;P&gt;wow,&lt;/P&gt;&lt;P&gt;thank you very much for a very good and explained solution!!&lt;/P&gt;&lt;P&gt;this was very helpful both to my model and my knowledge.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Aug 2019 12:10:57 GMT</pubDate>
    <dc:creator>roisolberg</dc:creator>
    <dc:date>2019-08-19T12:10:57Z</dc:date>
    <item>
      <title>YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613690#M143708</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;First, i know there has been many posts and questions regarding this issue, but i haven't found a solution&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am trying to make a YTD/LYTD calculations, that will count the number of opened projects in 2018 vs 2019&lt;/P&gt;&lt;P&gt;iv'e defined a master calendar and it is working well and in it i defined :&lt;/P&gt;&lt;P&gt;If( TempDate - YearStart(TempDate) &amp;lt;= Today() - YearStart(Today()), 1, 0 ) as IsInYTD&lt;/P&gt;&lt;P&gt;so far so good, now i tried doing a bar chart to compare 2019-2018 by month&lt;/P&gt;&lt;P&gt;so i defined the variables in the UI variables (Based on my calendar)&lt;/P&gt;&lt;P&gt;vMaxDate - Max(KickOffDate)&lt;/P&gt;&lt;P&gt;vMaxYear -&amp;nbsp;Max(KickOffYear)&lt;/P&gt;&lt;P&gt;vPriorYear -&amp;nbsp;Max(KickOffYear)-1&lt;/P&gt;&lt;P&gt;and than i tried to do the set expression that will count the number of projects in that time period,&lt;/P&gt;&lt;P&gt;when i do the set expression using&amp;nbsp;{'2019'}&amp;nbsp; and&amp;nbsp; {'2018'}&amp;nbsp;&amp;nbsp;it works, but when i use variables it makes the sum of 2018+2019&lt;/P&gt;&lt;P&gt;*CountProjects is defined in the project table '1 as CountProjects'&lt;/P&gt;&lt;P&gt;Count( {$&amp;lt;IsInYTD={1},KickOffYear={'2019'}&amp;gt;} CountProjects )&amp;nbsp;&lt;/P&gt;&lt;P&gt;Count( {$&amp;lt;IsInYTD={1},KickOffYear={'2018'}&amp;gt;} CountProjects )&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clipboard_image_0.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17241iAE67C06FEA0C4957/image-size/medium?v=v2&amp;amp;px=400" role="button" title="clipboard_image_0.png" alt="clipboard_image_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;when i try to change it to the variable using this set:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Count( {$&amp;lt;IsInYTD={1},KickOffYear={'=$(vMaxYear)'}&amp;gt;} CountProjects ) - 2019&lt;/P&gt;&lt;P&gt;Count( {$&amp;lt;IsInYTD={1},KickOffYear={'=$(vPriorYear)'}&amp;gt;} CountProjects )&amp;nbsp; - 2018&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i get the same value for both:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clipboard_image_1.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17245i74A86F3F34E9E3D8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="clipboard_image_1.png" alt="clipboard_image_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;iv'e tried looking for this in older posts but no matter how i tried i didn't get the right calculation if any.&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 02:42:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613690#M143708</guid>
      <dc:creator>roisolberg</dc:creator>
      <dc:date>2024-11-16T02:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613697#M143711</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;First check whether correct values are coming in your variables or not.&lt;/P&gt;&lt;P&gt;If Yes, then try this&lt;/P&gt;&lt;P&gt;Count( {$&amp;lt;IsInYTD={1},KickOffYear={'&lt;FONT face="arial black,avant garde"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;$(=&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;vMaxYear)'}&amp;gt;} CountProjects ) - 2019&lt;/P&gt;&lt;P&gt;Count( {$&amp;lt;IsInYTD={1},KickOffYear={'&lt;FONT face="arial black,avant garde"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;$(=&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;vPriorYear)'}&amp;gt;} CountProjects )&amp;nbsp; - 2018&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Shubham&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 08:31:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613697#M143711</guid>
      <dc:creator>Shubham_Deshmukh</dc:creator>
      <dc:date>2019-08-19T08:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613705#M143712</link>
      <description>&lt;P&gt;Hi Shubham,&lt;/P&gt;&lt;P&gt;iv'e tried this as well but the outcome is 0..&lt;/P&gt;&lt;P&gt;You can see here that the 'MaxYear' and 'PriorYear' looks ok,&amp;nbsp;&lt;/P&gt;&lt;P&gt;the Last year i've kept without any changes and i changed the YTD as&amp;nbsp; per your replay&lt;/P&gt;&lt;P&gt;this is the outcome:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clipboard_image_1.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17248i5123C019352FBF13/image-size/medium?v=v2&amp;amp;px=400" role="button" title="clipboard_image_1.png" alt="clipboard_image_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 08:42:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613705#M143712</guid>
      <dc:creator>roisolberg</dc:creator>
      <dc:date>2019-08-19T08:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613720#M143717</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;WHy you are not using normal way for YTD and LYTD? like this&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;YTD:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;=Count({$&amp;lt;&lt;EM&gt;yourDate&lt;/EM&gt; = {'&amp;gt;=$(=YearStart(Today())))'}&amp;gt;} &lt;EM&gt;yourQuantity&lt;/EM&gt;)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LYTD:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;=Count({$&amp;lt;&lt;EM&gt;yourDate&lt;/EM&gt; = {'&amp;gt;=$(=Date(AddYears(YearStart(Today()),-1)))&amp;lt;$(=Date(AddYears(Today(),-1)))'}&amp;gt;} &lt;EM&gt;yourQuantity&lt;/EM&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 09:04:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613720#M143717</guid>
      <dc:creator>Shubham_Deshmukh</dc:creator>
      <dc:date>2019-08-19T09:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613736#M143720</link>
      <description>&lt;P&gt;Hi Shubham,&lt;/P&gt;&lt;P&gt;i just tried doing it your way and i&amp;nbsp; get zero's in the calculation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;am i missing something?&lt;/P&gt;&lt;P&gt;the kickoffdate is defined in the master calendar, should i create it differently? (for example in the original table?)&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 09:35:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613736#M143720</guid>
      <dc:creator>roisolberg</dc:creator>
      <dc:date>2019-08-19T09:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613773#M143733</link>
      <description>&lt;P&gt;No Need to create any dates, I have normal orderDate in my data and I am using the&amp;nbsp; Same.&lt;/P&gt;&lt;P&gt;Below code is working me now, check this one,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dimension:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;MonthField created from date field in Master Calendar&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;YTD :&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;OrderDate = {"&amp;gt;=$(=YearStart(Today()))&amp;lt;=$(=Today())"}&amp;gt;}ShippingCost)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LYTD:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;OrderDate = {"&amp;gt;=$(=AddYears(YearStart(Today()),-1))&amp;lt;=$(=AddYears(Today(),-1))"}&amp;gt;}ShippingCost)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bar.png" style="width: 730px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17265iFF5256A623D486C3/image-size/large?v=v2&amp;amp;px=999" role="button" title="bar.png" alt="bar.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Let me know.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 10:46:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613773#M143733</guid>
      <dc:creator>Shubham_Deshmukh</dc:creator>
      <dc:date>2019-08-19T10:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613782#M143738</link>
      <description>&lt;P&gt;First of all thank you very much for your help! i really appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The YTD is working well, but the LYTD gives me somehow 2018+2019&lt;/P&gt;&lt;P&gt;only when i subtract&amp;nbsp; YTD-LYTD i get an accurate LYTD..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 11:02:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613782#M143738</guid>
      <dc:creator>roisolberg</dc:creator>
      <dc:date>2019-08-19T11:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613786#M143742</link>
      <description>&lt;P&gt;Actually, you have to check the data because it is impossible what you are saying,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;=Sum({&amp;lt;OrderDate = {"&amp;gt;=$(=&lt;STRONG&gt;AddYears(YearStart(Today()),-1)&lt;/STRONG&gt;)&amp;lt;=$(=&lt;STRONG&gt;AddYears(Today(),-1)&lt;/STRONG&gt;)"}&amp;gt;}ShippingCost)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;AddYears(YearStart(Today()),-1) -&amp;gt;&amp;nbsp; 01-JAN-2018&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;AddYears(Today(),-1) -&amp;gt; 19-AUG-2018&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;So anyhow it will give you data between&amp;nbsp;01-JAN-2018 and&amp;nbsp;19-AUG-2018&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 11:10:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613786#M143742</guid>
      <dc:creator>Shubham_Deshmukh</dc:creator>
      <dc:date>2019-08-19T11:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613806#M143750</link>
      <description>&lt;P&gt;i understand, yet it still gives me a count of 66 that is 30+36 (2018+2019)&lt;/P&gt;&lt;P&gt;if i filter by the year, i get the correct results, but without a filter it sums them both together...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 11:43:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613806#M143750</guid>
      <dc:creator>roisolberg</dc:creator>
      <dc:date>2019-08-19T11:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613811#M143751</link>
      <description>&lt;P&gt;Let's debug your expression:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Count( {$&amp;lt;IsInYTD={1},KickOffYear={'=$(vMaxYear)'}&amp;gt;} CountProjects )&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;By using single quotes (') in your element list, you are telling QS to filter all KickOffYears which have the same text value with whatever is within the quotes. Your&amp;nbsp;&lt;SPAN&gt;$(vMaxYear) will not be evaluated, it is seen as part of the string. None of your KickOffYears have a text value of =(vMaxYear), so the field selection fails. (I am not sure why this returns everything and not 0).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I can propose 2 solutions here. One is using a search mask, what is what I guess you wanted to do:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Count( {$&amp;lt;IsInYTD={1},KickOffYear={"$(vMaxYear)"}&amp;gt;} CountProjects )&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note the use of the double quotes: they initiate a search mode, and within search mode, formulas are evaluated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, I'd rather not force the engine to make a heavy search and instead just do a little more work and add an evaluation level to the whole formula:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;$(='Count( {$&amp;lt;IsInYTD={1},KickOffYear={' &amp;amp; $(vMaxYear) &amp;amp; '}&amp;gt;} CountProjects )')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This way, the variable will be evaluated first, then its value will be inserted into the string (much like your own manual versions that work), and then the final evaluation will take place.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 11:58:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613811#M143751</guid>
      <dc:creator>gmenoutis</dc:creator>
      <dc:date>2019-08-19T11:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613815#M143753</link>
      <description>&lt;P&gt;wow,&lt;/P&gt;&lt;P&gt;thank you very much for a very good and explained solution!!&lt;/P&gt;&lt;P&gt;this was very helpful both to my model and my knowledge.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 12:10:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613815#M143753</guid>
      <dc:creator>roisolberg</dc:creator>
      <dc:date>2019-08-19T12:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: YTD calculations not working with variable</title>
      <link>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613830#M143759</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/3767"&gt;@gmenoutis&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;That' great knowledge sharing.&lt;/P&gt;&lt;P&gt;Can u pls put some light on my revert, why it is not working in&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/36692"&gt;@roisolberg&lt;/a&gt;&amp;nbsp;'s case?&lt;/P&gt;&lt;P&gt;-Shubham&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 12:34:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Visualization-and-Usability/YTD-calculations-not-working-with-variable/m-p/1613830#M143759</guid>
      <dc:creator>Shubham_Deshmukh</dc:creator>
      <dc:date>2019-08-19T12:34:27Z</dc:date>
    </item>
  </channel>
</rss>

