<?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: Creating Max Drawdown calculation in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300063#M405329</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeh exactly, it was because I needed to illustrate the requirement to use the date to define the range, else I'd have got replies that didn't take that into consideration and just used the full data set &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; Awesome thank you! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 May 2017 15:32:48 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-05-19T15:32:48Z</dc:date>
    <item>
      <title>Creating Max Drawdown calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300059#M405325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm looking to find out if anyone can help with creating a Max Drawdown calculation please.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a spreadsheet that lists the following -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2x tabs are a snapshot of the tables that would be coming in (Values,Indate)&lt;/P&gt;&lt;P&gt;1x Tab to show the Excel workings of how you calculate Max Drawdown on that data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Importantly each Product has an Indate that is when the Max Drawdown needs to start (and has a vast array of dates and values for before that date. So I need to apply either Set/Aggr/If to define the range to look at as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've searched and worked through the current examples on here about Drawdown but they havent worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hoping you guys can help,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Ryan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2017 09:58:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300059#M405325</guid>
      <dc:creator />
      <dc:date>2017-05-19T09:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Max Drawdown calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300060#M405326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;2 questions for you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Do you want this to be done strictly on the front end?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) InDate is 6/1/2015, but the 'Workings' tab expressions use no sort of logic to incoporate InDate? Is that by mistake or am I missing something here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2017 15:17:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300060#M405326</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-05-19T15:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Max Drawdown calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300061#M405327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for replying,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Nope, happy to backend it&lt;/P&gt;&lt;P&gt;2) Its because currently they manually edit down the data once exported to excel so the Indate was part of the export (leaving them with just that dataset) I changed the date to be mid way through the dataset to be more realistic to what I'm working with, as in I have data for the last 10 years, but the calculations must start from the InDate, does that make sense?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;Ryan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2017 15:25:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300061#M405327</guid>
      <dc:creator />
      <dc:date>2017-05-19T15:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Max Drawdown calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300062#M405328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the data before InDate is not relevant then? Make sense... will try to get a sample across in a little bit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2017 15:30:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300062#M405328</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-05-19T15:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Max Drawdown calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300063#M405329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeh exactly, it was because I needed to illustrate the requirement to use the date to define the range, else I'd have got replies that didn't take that into consideration and just used the full data set &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; Awesome thank you! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2017 15:32:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300063#M405329</guid>
      <dc:creator />
      <dc:date>2017-05-19T15:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Max Drawdown calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300064#M405330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Date, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Product&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[..\..\Downloads\TestData.xlsx]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(ooxml, embedded labels, table is Values);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Left Join (Table1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Product, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; InDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[..\..\Downloads\TestData.xlsx]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(ooxml, embedded labels, table is InDate);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TempTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Product,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Date,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Value,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Product = Previous(Product), RangeSum(Peek('Ret + 1'), Log(1+Value)), Log(1+Value)) as [Ret + 1]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where Date &amp;gt;= InDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By Product, Date;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TempTable2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Product,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Date,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Value,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Exp([Ret + 1]) as [Ret + 1],&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Product = Previous(Product), If(Exp([Ret + 1]) &amp;lt;= Peek('Ret + 1 New'), Peek('Ret + 1 New'), Exp([Ret + 1])), Exp([Ret + 1])) as [Ret + 1 New],&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Exp([Ret + 1])/If(Exp([Ret + 1]) &amp;lt;= Peek('Ret + 1 New'), Peek('Ret + 1 New'), Exp([Ret + 1])) - 1 as temp&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;// If(Product = Previous(Product), &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;// If(Exp([Ret + 1])/If(Exp([Ret + 1]) &amp;lt;= Peek('Ret + 1 New'), Peek('Ret + 1 New'), Exp([Ret + 1])) - 1 &amp;lt; Peek('Max Draw'),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;// Exp([Ret + 1])/If(Exp([Ret + 1]) &amp;lt;= Peek('Ret + 1 New'), Peek('Ret + 1 New'), Exp([Ret + 1])) - 1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;// Peek('Max Draw')), 0) as [Max Draw]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident TempTable;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Left Join (Table1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Product,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Min(temp) as [Max Draw]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident TempTable2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group By Product;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table TempTable, TempTable2;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2017 15:51:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300064#M405330</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-05-19T15:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Max Drawdown calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300065#M405331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Worked like a charm, absolute hero thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 May 2017 21:37:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Max-Drawdown-calculation/m-p/1300065#M405331</guid>
      <dc:creator />
      <dc:date>2017-05-22T21:37:07Z</dc:date>
    </item>
  </channel>
</rss>

