<?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: Calculate YTD up to specific Date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769350#M454505</link>
    <description>&lt;P&gt;In our load statement for our calendar table we create the following flag:&lt;/P&gt;&lt;P&gt;//Our "Link" table contains the transactions dates from our fact table.&lt;/P&gt;&lt;P&gt;Temp:&lt;BR /&gt;Load&lt;BR /&gt;min(TransactionDate) as minDate,&lt;BR /&gt;max(TransactionDate) as maxDate&lt;BR /&gt;Resident Link;&lt;/P&gt;&lt;P&gt;Let varMinDate = Num(Peek('minDate', 0, 'Temp'));&lt;/P&gt;&lt;P&gt;Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));&lt;/P&gt;&lt;P&gt;DROP Table Temp;&lt;/P&gt;&lt;P&gt;//Then in our Master Table script, we have the following statement&lt;/P&gt;&lt;P&gt;if(year(TempDate)&amp;lt;Year(addyears(Today(),-1)),1,(inyeartodate(makedate(year(today()), month(TempDate), day(TempDate)), today(), 0) * -1)) as CurPrevYTD,&lt;/P&gt;&lt;P&gt;We then use the flag in a set analysis formula like such:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Year={$(=Max(Year)-1)}, CurPrevYTD={1}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Dec 2020 20:25:53 GMT</pubDate>
    <dc:creator>lfholland</dc:creator>
    <dc:date>2020-12-17T20:25:53Z</dc:date>
    <item>
      <title>Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768149#M454422</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a requirement to calculate the sum of sales from the start of the current year up to a selected date. let's say Today's date&lt;/P&gt;&lt;P&gt;which is 13-Dec-2020&amp;nbsp;&lt;/P&gt;&lt;P&gt;so data will be from 01-Jan-2020 to&amp;nbsp;13-Dec-2020&amp;nbsp;&lt;/P&gt;&lt;P&gt;Plus to calculate the same from the previous year up the same peer date&amp;nbsp;&lt;/P&gt;&lt;P&gt;from 01-Jan-2019 to&amp;nbsp;13-Dec-2019&lt;/P&gt;&lt;P&gt;I use the below but it doesn't work at all&amp;nbsp;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Trx Date]=,Year=,Month=,Quarter=, [Trx Date]={"&amp;gt;=$(=YearStart(Max([Trx Date])))&amp;lt;=$(=&lt;STRONG&gt;Today()&lt;/STRONG&gt;)"}&amp;gt;}Amount)&lt;/P&gt;&lt;P&gt;how to do this. please&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 23:27:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768149#M454422</guid>
      <dc:creator>khaled</dc:creator>
      <dc:date>2024-11-15T23:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768152#M454423</link>
      <description>&lt;P&gt;Try to make these adjustments to your expression:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;sum({&amp;lt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[Trx Date]=,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Year=,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Month=,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Quarter=,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[Trx Date]={"&amp;gt;=&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;/FONT&gt;$(=YearStart(Max([Trx Date])))&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;/FONT&gt;&amp;lt;=&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;/FONT&gt;$(=&lt;/SPAN&gt;Today()&lt;SPAN&gt;)&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;/FONT&gt;"}&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;}Amount)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Dec 2020 18:14:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768152#M454423</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-12-13T18:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768161#M454425</link>
      <description>&lt;P&gt;Perhaps this&amp;nbsp; and make sure the date formats If you need to adjust.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum({&amp;lt;&lt;FONT color="#993366"&gt;&lt;STRIKE&gt;[Trx Date]=,&lt;/STRIKE&gt;&lt;/FONT&gt;Year=,Month=,Quarter=, [Trx Date]={"&amp;gt;=$(=YearStart(Max([Trx Date])))&amp;lt;=$(=&lt;FONT color="#FF0000"&gt;Max([Trx Date]&lt;/FONT&gt;))"&lt;FONT color="#FF0000"&gt;,&amp;nbsp;&amp;nbsp;"&amp;gt;=$(=YearStart(AddYears(Max([Trx Date]), -1)))&amp;lt;=$(=AddYears(Max([Trx Date]), -1))"&lt;/FONT&gt;}&amp;gt;} Amount)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Dec 2020 20:03:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768161#M454425</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2020-12-13T20:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768399#M454442</link>
      <description>&lt;P&gt;Hello Vegar,&lt;/P&gt;&lt;P&gt;Thanks but the formula is not working&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2020 22:21:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768399#M454442</guid>
      <dc:creator>khaled</dc:creator>
      <dc:date>2020-12-14T22:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768400#M454443</link>
      <description>&lt;P&gt;Hello Anil,&lt;/P&gt;&lt;P&gt;I need to calculate the amount as of Today's Date. the provided formula works as per the whole month.&lt;/P&gt;&lt;P&gt;for example&amp;nbsp;&lt;/P&gt;&lt;P&gt;if today is 10-Dec-2020 I need to get the data as of 10 not as of 31th&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2020 22:23:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768400#M454443</guid>
      <dc:creator>khaled</dc:creator>
      <dc:date>2020-12-14T22:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768416#M454446</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/76249"&gt;@khaled&lt;/a&gt;&amp;nbsp; make sure that your date field is in proper date format and not text. try to check max(Date) in text object, if it returns value then it is in proper format.&lt;/P&gt;&lt;P&gt;Try below if your Date field is properly formatted&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sum({&amp;lt;[Trx Date]=,Year=,Month=,Quarter=, [Trx Date]={"&amp;gt;=$(=date(YearStart(Max([Trx Date]))))&amp;lt;=$(=date(&lt;/SPAN&gt;&lt;STRONG&gt;Today()&lt;/STRONG&gt;&lt;SPAN&gt;))"}&amp;gt;}Amount)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2020 23:23:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768416#M454446</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-12-14T23:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768484#M454454</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Trx Date field is a date in the DB&amp;nbsp; of format &lt;STRONG&gt;DD-MON-RRRR HH24:MI:SS&lt;/STRONG&gt; and I didn't format it, Should I?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 07:38:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768484#M454454</guid>
      <dc:creator>khaled</dc:creator>
      <dc:date>2020-12-15T07:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768491#M454456</link>
      <description>&lt;P&gt;The string format is not that important when using &amp;gt;= and &amp;lt;, however it is important that the [Trx Date] intepreted as a numeric (timestamp or date) by QlikView.&lt;/P&gt;&lt;P&gt;Try loading it into the datamodel as follows. Assuming 'MON' is the same as 'MMM' in QlikView.&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOAD&amp;nbsp;&lt;BR /&gt;timestamp#([Trx Date], 'DD-MMM-YYYY hh:mm:ss') as [Trx Date]&lt;BR /&gt;FROM ...&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 07:58:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1768491#M454456</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-12-15T07:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769068#M454486</link>
      <description>&lt;P&gt;Hello Vegar,&lt;/P&gt;&lt;P&gt;I followed your step now Trx Date looks like&amp;nbsp;44143.593981481&lt;/P&gt;&lt;P&gt;I tried the formula again but it shows zero&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 19:00:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769068#M454486</guid>
      <dc:creator>khaled</dc:creator>
      <dc:date>2020-12-16T19:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769083#M454489</link>
      <description>&lt;P&gt;That's the numeric representation of an timestamp.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you need to present it as a timestamp you can wrap timestamp () around it, if you only need the date part without the time of day then wrap dayname() around it like this &lt;EM&gt;&lt;STRONG&gt;timestamp&lt;/STRONG&gt; (timestamp#([Trx Date], 'DD-MMM-YYYY hh:mm:ss')&lt;STRONG&gt;)&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt; or &lt;EM&gt;&lt;STRONG&gt;dayname(&lt;/STRONG&gt; timestamp#([Trx Date], 'DD-MMM-YYYY hh:mm:ss')&lt;STRONG&gt;)&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 19:52:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769083#M454489</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-12-16T19:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769140#M454492</link>
      <description>&lt;P&gt;Kindly share sample data set to handle this.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2020 07:02:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769140#M454492</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2020-12-17T07:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769167#M454493</link>
      <description>&lt;P&gt;Hello Anil,&lt;/P&gt;&lt;P&gt;Do you want me to share excel file data ?&lt;/P&gt;&lt;P&gt;or the qvd itself&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2020 08:37:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769167#M454493</guid>
      <dc:creator>khaled</dc:creator>
      <dc:date>2020-12-17T08:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769344#M454503</link>
      <description>&lt;P&gt;Hi Anil,&lt;/P&gt;&lt;P&gt;Kindly Check the Sample Data&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2020 19:25:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769344#M454503</guid>
      <dc:creator>khaled</dc:creator>
      <dc:date>2020-12-17T19:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate YTD up to specific Date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769350#M454505</link>
      <description>&lt;P&gt;In our load statement for our calendar table we create the following flag:&lt;/P&gt;&lt;P&gt;//Our "Link" table contains the transactions dates from our fact table.&lt;/P&gt;&lt;P&gt;Temp:&lt;BR /&gt;Load&lt;BR /&gt;min(TransactionDate) as minDate,&lt;BR /&gt;max(TransactionDate) as maxDate&lt;BR /&gt;Resident Link;&lt;/P&gt;&lt;P&gt;Let varMinDate = Num(Peek('minDate', 0, 'Temp'));&lt;/P&gt;&lt;P&gt;Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));&lt;/P&gt;&lt;P&gt;DROP Table Temp;&lt;/P&gt;&lt;P&gt;//Then in our Master Table script, we have the following statement&lt;/P&gt;&lt;P&gt;if(year(TempDate)&amp;lt;Year(addyears(Today(),-1)),1,(inyeartodate(makedate(year(today()), month(TempDate), day(TempDate)), today(), 0) * -1)) as CurPrevYTD,&lt;/P&gt;&lt;P&gt;We then use the flag in a set analysis formula like such:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Year={$(=Max(Year)-1)}, CurPrevYTD={1}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2020 20:25:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-YTD-up-to-specific-Date/m-p/1769350#M454505</guid>
      <dc:creator>lfholland</dc:creator>
      <dc:date>2020-12-17T20:25:53Z</dc:date>
    </item>
  </channel>
</rss>

