<?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 Help with calculation... in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238091#M89050</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your chosen period is selected, then you can use something like:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum({&amp;lt;TransID = {$(=Max(TransID))}&amp;gt;} Bal)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Since only one record will have the Max TransID value, that sum will give you that balance.&lt;/P&gt;&lt;P&gt;Your whole expression would be:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum({&amp;lt;TransType = {'Deposit'}&amp;gt;} Cash) -&lt;BR /&gt;Sum({&amp;lt;TransType = {'Withdrawl'}&amp;gt;} Cash) -&lt;BR /&gt;Sum({&amp;lt;TransID = {$(=Max(TransID))}&amp;gt;} Bal)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 May 2010 21:31:32 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-05-11T21:31:32Z</dc:date>
    <item>
      <title>Help with calculation...</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238090#M89049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I have a table like this:&lt;/P&gt;&lt;P&gt;TransID, Date, TransType, Cash, Pending, Bal&lt;/P&gt;&lt;P&gt;01234, 20090101, Deposit, 1234, -,3234&lt;/P&gt;&lt;P&gt;01235,20090115, Withdrawal, -,34, 3200&lt;/P&gt;&lt;P&gt;01236, 20090129, Deposit, 12, -, 3212&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to sum up all deposits and all withdrawals per period (year, month etc), that is, sum(cash where transtype = deposit) and sum(pending where transtype=withdrawal) and use the Bal-value from the last transaction.&lt;/P&gt;&lt;P&gt;So my calculation would be something like vCal= sum(cash where transtype = 'deposit')-sum(pending where transtype='withdrawal')- Bal where max(transID)&lt;/P&gt;&lt;P&gt;In my example above that would be vCal=1246-34-3212 = -2000&lt;/P&gt;&lt;P&gt;How can I 'fetch' the value of Bal on the last transaction for the chosen period?&lt;/P&gt;&lt;P&gt;Observe that Im a beginner... &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Br&lt;/P&gt;&lt;P&gt;Cristian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 May 2010 21:21:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238090#M89049</guid>
      <dc:creator />
      <dc:date>2010-05-11T21:21:35Z</dc:date>
    </item>
    <item>
      <title>Help with calculation...</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238091#M89050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your chosen period is selected, then you can use something like:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum({&amp;lt;TransID = {$(=Max(TransID))}&amp;gt;} Bal)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Since only one record will have the Max TransID value, that sum will give you that balance.&lt;/P&gt;&lt;P&gt;Your whole expression would be:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum({&amp;lt;TransType = {'Deposit'}&amp;gt;} Cash) -&lt;BR /&gt;Sum({&amp;lt;TransType = {'Withdrawl'}&amp;gt;} Cash) -&lt;BR /&gt;Sum({&amp;lt;TransID = {$(=Max(TransID))}&amp;gt;} Bal)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 May 2010 21:31:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238091#M89050</guid>
      <dc:creator />
      <dc:date>2010-05-11T21:31:32Z</dc:date>
    </item>
    <item>
      <title>Help with calculation...</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238092#M89051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Sum({&amp;lt;TransType = {'Deposit'}&amp;gt;} Cash) -&lt;BR /&gt;Sum({&amp;lt;TransType = {'Withdrawal'}&amp;gt;} Pending) -&lt;BR /&gt;Sum({&amp;lt;TransID = {$(=Max(TransID))}&amp;gt;} Bal)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This return de last TransID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Sum({&amp;lt;TransID = {$(=Max(TransID))}&amp;gt;} Bal)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You can see the reference Manual Set Analisys.&lt;/P&gt;&lt;P&gt;Regrads.&lt;/P&gt;&lt;P&gt;Tonial.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 May 2010 21:39:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238092#M89051</guid>
      <dc:creator />
      <dc:date>2010-05-11T21:39:31Z</dc:date>
    </item>
    <item>
      <title>Help with calculation...</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238093#M89052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! This works! But, I forgot that I also would like do this calculation per AccountID. My table also have an AccountID field like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TransID, AccountID, Date, TransType, Cash, Pending, Bal&lt;/P&gt;&lt;P&gt;01234,123, 20090101, Deposit, 1234, -,3234&lt;/P&gt;&lt;P&gt;01235,123,20090115, Withdrawal, -,34, 3200&lt;/P&gt;&lt;P&gt;01236, 123,20090129, Deposit, 12, -, 3212&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Would it be a different calculation? Still I will choose a period but the calculation should ne 'grouped' by accountId.&lt;/P&gt;&lt;P&gt;Br&lt;/P&gt;&lt;P&gt;Cristian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 May 2010 21:47:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238093#M89052</guid>
      <dc:creator />
      <dc:date>2010-05-11T21:47:28Z</dc:date>
    </item>
    <item>
      <title>Help with calculation...</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238094#M89053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Sum({&amp;lt;TransType = {'Deposit'}&amp;gt;} TOTAL &amp;lt;AccountID&amp;gt; Cash) -&lt;BR /&gt;Sum({&amp;lt;TransType = {'Withdrawal'}&amp;gt;} TOTAL &amp;lt;AccountID&amp;gt; Pending) -&lt;BR /&gt;Sum({&amp;lt;TransID = {$(=Max(TransID))}&amp;gt;} TOTAL &amp;lt;AccountID&amp;gt; Bal)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 May 2010 21:54:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238094#M89053</guid>
      <dc:creator />
      <dc:date>2010-05-11T21:54:16Z</dc:date>
    </item>
    <item>
      <title>Help with calculation...</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238095#M89054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I still have a problem.&lt;/P&gt;&lt;P&gt;The solutions suggested above didnt work (well they do but not as I want).&lt;/P&gt;&lt;P&gt;The 'Calculation' in the table below is exactly as the solution suggested by Mr Reaño. If I dont chose a date my calculation doesnt sum up as I want. I would like it to show, per each row (period) in the table," Calculation=Deposit-Withdrawal-Bal" where deposit= sum of deposits in the period, withdrawal=sum of withdrawals in the period, bal= value of field 'Bal' when max(transID) for the period. The current solution works only when a date is chosen and a single AccountID is present in that period. I would like it to work even if I dont choose an AccountID. Any suggestions are appreciated.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Br&lt;/P&gt;&lt;P&gt;Cristian&lt;/P&gt;&lt;P&gt;&lt;A href="http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/8345.CalcTest.jpg"&gt;&lt;IMG alt="" border="0" src="http://community.qlik.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Discussions.Components.Files/11/8345.CalcTest.jpg" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 May 2010 19:00:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238095#M89054</guid>
      <dc:creator />
      <dc:date>2010-05-17T19:00:07Z</dc:date>
    </item>
    <item>
      <title>Help with calculation...</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238096#M89055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;Look this,&lt;BR /&gt;Sum({&amp;lt;TransType = {'Deposit'}&amp;gt;} TOTAL &amp;lt;YearMonth, AccountID&amp;gt; Cash) -&lt;BR /&gt;Sum({&amp;lt;TransType = {'Withdrawal'}&amp;gt;} TOTAL &amp;lt;YearMonth, AccountID&amp;gt; Pending) -&lt;BR /&gt;Sum({&amp;lt;TransID = {$(=Max(TransID))}&amp;gt;} TOTAL &amp;lt;YearMonth, AccountID&amp;gt; Bal)&lt;BR /&gt;Regards,&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 May 2010 16:35:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238096#M89055</guid>
      <dc:creator />
      <dc:date>2010-05-19T16:35:07Z</dc:date>
    </item>
    <item>
      <title>Help with calculation...</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238097#M89056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm frustrated. It doesnt work. Is it my crosstable that is not working properly? If I choose AccountID and Year Month the calculation works fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 May 2010 12:44:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238097#M89056</guid>
      <dc:creator />
      <dc:date>2010-05-24T12:44:47Z</dc:date>
    </item>
    <item>
      <title>Help with calculation...</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238098#M89057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, so for each accountID and Year Month it works fine. But, if I want to see the calculation only for a Month the calculation should sum all deposits, all withdrawals and each Sum({&amp;lt;TransID = {$(=Max(TransID))}&amp;gt;} BalCash) for every AccountID. Right now the calculation sums up all deposits, all withdrawals and takes only the last Sum({&amp;lt;TransID = {$(=Max(TransID))}&amp;gt;} BalCash) for the month.&lt;/P&gt;&lt;P&gt;How can I change Sum({&amp;lt;TransID = {$(=Max(TransIDr))}&amp;gt;} BalCash) to consider every AccountID when I dont choose a specific AccountID?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;cristian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jun 2010 11:30:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation/m-p/238098#M89057</guid>
      <dc:creator />
      <dc:date>2010-06-07T11:30:27Z</dc:date>
    </item>
  </channel>
</rss>

