<?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: set analysis for calculating amount in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/set-analysis-for-calculating-amount/m-p/631470#M231748</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The expression is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum(Aggr(FirstSortedValue(Value, DateInv),Customer))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eduardo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 May 2014 20:14:42 GMT</pubDate>
    <dc:creator>eduardo_sommer</dc:creator>
    <dc:date>2014-05-28T20:14:42Z</dc:date>
    <item>
      <title>set analysis for calculating amount</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-for-calculating-amount/m-p/631469#M231747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I got to calculate the sum of all invoices for all customers whose first invoices fall in a particular month.&lt;/P&gt;&lt;P&gt;I am trying this expression&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;My data looks like this&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;1. Date: 3/25/2012&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Customer: Customer1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Amount: 25&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;2. Date: 3/27/2012&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Customer: Customer1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Amount: 25&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;3. Date: 3/28/2012&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Customer: Customer2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Amount:50&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output I need is sum of amount for 1 and 3 i.e. 75 because these are the first invoices for Customer1 and Customer2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using this expression&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff00ff;"&gt;&lt;STRONG&gt;sum(if (AGGR(if(MonthName(Min({1&amp;lt;TxnType={'Invoice'}&amp;gt;}TxnDate)) = MonthName(Max(TxnDate)), 1, 0),CustomerListID, TxnLineID) &amp;gt; 0, if(AccountType='Income', Amount, 0)))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and it is giving me output 100.&lt;/P&gt;&lt;P&gt;What is going on here?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 20:07:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-for-calculating-amount/m-p/631469#M231747</guid>
      <dc:creator />
      <dc:date>2014-05-28T20:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis for calculating amount</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-for-calculating-amount/m-p/631470#M231748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The expression is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum(Aggr(FirstSortedValue(Value, DateInv),Customer))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eduardo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 20:14:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-for-calculating-amount/m-p/631470#M231748</guid>
      <dc:creator>eduardo_sommer</dc:creator>
      <dc:date>2014-05-28T20:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis for calculating amount</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-for-calculating-amount/m-p/631471#M231749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure how that expression works ....but i have an idea for your problem..which i did similarly when i had this problem:&lt;/P&gt;&lt;P&gt;Originaltable:&lt;/P&gt;&lt;P&gt;Load InvNo&amp;amp;CustomerNo&amp;amp;DateofTransaction as key&lt;/P&gt;&lt;P&gt;InvNo,&lt;/P&gt;&lt;P&gt;CustomerNo,&lt;/P&gt;&lt;P&gt;DateofTransaction,&lt;/P&gt;&lt;P&gt;Amount from A;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join (Originaltable)&lt;/P&gt;&lt;P&gt;Load&amp;nbsp; InvNo&amp;amp;CustomerNo&amp;amp;DateofTransaction as key,&lt;/P&gt;&lt;P&gt;flagmindate&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;InvNo,&lt;/P&gt;&lt;P&gt;CustomerNo,&lt;/P&gt;&lt;P&gt;Date(min(DateofTransaction)) as DateofTransaction,&lt;/P&gt;&lt;P&gt;1 as flagmindate&lt;/P&gt;&lt;P&gt;resident Originaltable&lt;/P&gt;&lt;P&gt;group by &lt;/P&gt;&lt;P&gt;InvNo,&lt;/P&gt;&lt;P&gt;CustomerNo&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 20:30:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-for-calculating-amount/m-p/631471#M231749</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-05-28T20:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis for calculating amount</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-for-calculating-amount/m-p/631472#M231750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, Ramya.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the Vinay's idea of creating a flag for the first invoice per costumer is a good one. But if you want to get the frist invoice per costumer &lt;STRONG&gt;per month&lt;/STRONG&gt;, some changes to the code are necessary. Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_1401323145765634" jivemacro_uid="_1401323145765634" modifiedtitle="true"&gt;
&lt;P&gt;Invoices:&lt;/P&gt;
&lt;P&gt;Load&lt;/P&gt;
&lt;P&gt;&amp;nbsp; *,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Month(Date) as Month&lt;/P&gt;
&lt;P&gt;Inline [&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Invoice, Costumer, Date, Amount&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, Customer1, '03/25/2012', 25&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, Customer1, '03/27/2012', 25&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, Customer2, '03/28/2012', 50&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Left Join (Invoices) Load&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Costumer,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Month,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Date(Min(Date)) as Date,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 1 as FlagFirstInvoiceOfMonth&lt;/P&gt;
&lt;P&gt;Resident Invoices&lt;/P&gt;
&lt;P&gt;Group by Costumer, Month;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you would use this simple expression on your graphics and tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14013232493148436" jivemacro_uid="_14013232493148436"&gt;
&lt;P&gt;Sum({$&amp;lt;FlagFirstInvoiceOfMonth = {1}&amp;gt;} Amount)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example QVW is attached. Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 00:28:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-for-calculating-amount/m-p/631472#M231750</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-05-29T00:28:54Z</dc:date>
    </item>
  </channel>
</rss>

